Update app.py
Browse files
app.py
CHANGED
|
@@ -118,7 +118,6 @@ def run_mode_b_wrapper(prompt, num_keyframes, ref_files, progress=gr.Progress())
|
|
| 118 |
|
| 119 |
def run_video_production_wrapper(keyframes, prompt, duration, overlap_percent, echo_frames,
|
| 120 |
handler_strength, destination_convergence_strength,
|
| 121 |
-
guidance, stg, rescaling, num_inference_steps,
|
| 122 |
video_resolution, use_cont, use_cine,
|
| 123 |
progress=gr.Progress()):
|
| 124 |
yield {
|
|
@@ -126,10 +125,6 @@ def run_video_production_wrapper(keyframes, prompt, duration, overlap_percent, e
|
|
| 126 |
final_video_output: gr.update(value=None, visible=True, label="🎬 Produzindo seu filme... Por favor, aguarde.")
|
| 127 |
}
|
| 128 |
|
| 129 |
-
adv_params = {
|
| 130 |
-
"guidance_scale": guidance, "stg_scale": stg, "rescaling_scale": rescaling,
|
| 131 |
-
"num_inference_steps": num_inference_steps
|
| 132 |
-
}
|
| 133 |
resolution = int(video_resolution.split('x')[0])
|
| 134 |
|
| 135 |
video_fragments_so_far = []
|
|
@@ -138,7 +133,7 @@ def run_video_production_wrapper(keyframes, prompt, duration, overlap_percent, e
|
|
| 138 |
for update in aduc.task_produce_final_movie_with_feedback(
|
| 139 |
keyframes, prompt, duration, overlap_percent, echo_frames,
|
| 140 |
handler_strength, destination_convergence_strength,
|
| 141 |
-
|
| 142 |
):
|
| 143 |
if "fragment_path" in update and update["fragment_path"]:
|
| 144 |
video_fragments_so_far.append(update["fragment_path"])
|
|
@@ -162,7 +157,6 @@ def get_log_content():
|
|
| 162 |
|
| 163 |
def update_ui_language(lang_code):
|
| 164 |
lang_map = i18n.get(lang_code, i18n.get('en', {}))
|
| 165 |
-
# ... (a função de tradução permanece a mesma, mas está aqui para completude)
|
| 166 |
return {
|
| 167 |
title_md: gr.update(value=f"# {lang_map.get('app_title')}"),
|
| 168 |
subtitle_md: gr.update(value=lang_map.get('app_subtitle')),
|
|
@@ -180,16 +174,15 @@ def update_ui_language(lang_code):
|
|
| 180 |
step3_description_md: gr.update(value=lang_map.get('step3_description')),
|
| 181 |
continuity_director_checkbox: gr.update(label=lang_map.get('continuity_director_label')),
|
| 182 |
cinematographer_checkbox: gr.update(label=lang_map.get('cinematographer_label')),
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
produce_button: gr.update(value=lang_map.get('produce_button')),
|
| 188 |
-
advanced_accordion: gr.update(label=lang_map.get('advanced_accordion_label')),
|
| 189 |
-
guidance_scale_slider: gr.update(label=lang_map.get('guidance_label')),
|
| 190 |
-
stg_scale_slider: gr.update(label=lang_map.get('stg_label')),
|
| 191 |
-
rescaling_scale_slider: gr.update(label=lang_map.get('rescaling_label')),
|
| 192 |
-
num_inference_steps_slider: gr.update(label=lang_map.get('steps_label'), info=lang_map.get('steps_info')),
|
| 193 |
video_fragments_gallery: gr.update(label=lang_map.get('video_fragments_gallery_label')),
|
| 194 |
final_video_output: gr.update(label=lang_map.get('final_movie_with_audio_label')),
|
| 195 |
log_accordion: gr.update(label=lang_map.get('log_accordion_label')),
|
|
@@ -227,23 +220,18 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 227 |
continuity_director_checkbox = gr.Checkbox(label=default_lang.get('continuity_director_label'), value=True)
|
| 228 |
cinematographer_checkbox = gr.Checkbox(label=default_lang.get('cinematographer_label'), value=True, visible=False)
|
| 229 |
|
| 230 |
-
gr.Markdown("--- \n**Controles de Continuidade e Edição:**")
|
| 231 |
with gr.Row():
|
| 232 |
-
|
| 233 |
-
|
|
|
|
| 234 |
|
| 235 |
-
gr.Markdown("**Controle de Influência (
|
| 236 |
with gr.Row():
|
| 237 |
-
|
| 238 |
-
|
|
|
|
| 239 |
|
| 240 |
-
with gr.Accordion(default_lang.get('advanced_accordion_label'), open=False) as advanced_accordion:
|
| 241 |
-
with gr.Row():
|
| 242 |
-
guidance_scale_slider = gr.Slider(label=default_lang.get('guidance_label'), minimum=1.0, maximum=15.0, value=1.0, step=0.5)
|
| 243 |
-
stg_scale_slider = gr.Slider(label=default_lang.get('stg_label'), minimum=0.0, maximum=10.0, value=0.0, step=0.5)
|
| 244 |
-
rescaling_scale_slider = gr.Slider(label=default_lang.get('rescaling_label'), minimum=0.0, maximum=1.0, value=0.15, step=0.05)
|
| 245 |
-
with gr.Row():
|
| 246 |
-
num_inference_steps_slider = gr.Slider(label=default_lang.get('steps_label'), minimum=4, maximum=50, value=7, step=1, info=default_lang.get('steps_info'))
|
| 247 |
produce_button = gr.Button(default_lang.get('produce_button'), variant="primary")
|
| 248 |
|
| 249 |
video_fragments_gallery = gr.Gallery(label=default_lang.get('video_fragments_gallery_label'), visible=False, object_fit="contain", height="auto", type="filepath")
|
|
@@ -275,12 +263,12 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 275 |
fn=run_video_production_wrapper,
|
| 276 |
inputs=[
|
| 277 |
keyframe_gallery, prompt_input, duration_per_fragment_slider,
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
resolution_selector, continuity_director_checkbox, cinematographer_checkbox
|
| 285 |
],
|
| 286 |
outputs=[video_fragments_gallery, final_video_output]
|
|
|
|
| 118 |
|
| 119 |
def run_video_production_wrapper(keyframes, prompt, duration, overlap_percent, echo_frames,
|
| 120 |
handler_strength, destination_convergence_strength,
|
|
|
|
| 121 |
video_resolution, use_cont, use_cine,
|
| 122 |
progress=gr.Progress()):
|
| 123 |
yield {
|
|
|
|
| 125 |
final_video_output: gr.update(value=None, visible=True, label="🎬 Produzindo seu filme... Por favor, aguarde.")
|
| 126 |
}
|
| 127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
resolution = int(video_resolution.split('x')[0])
|
| 129 |
|
| 130 |
video_fragments_so_far = []
|
|
|
|
| 133 |
for update in aduc.task_produce_final_movie_with_feedback(
|
| 134 |
keyframes, prompt, duration, overlap_percent, echo_frames,
|
| 135 |
handler_strength, destination_convergence_strength,
|
| 136 |
+
resolution, use_cont, use_cine, progress
|
| 137 |
):
|
| 138 |
if "fragment_path" in update and update["fragment_path"]:
|
| 139 |
video_fragments_so_far.append(update["fragment_path"])
|
|
|
|
| 157 |
|
| 158 |
def update_ui_language(lang_code):
|
| 159 |
lang_map = i18n.get(lang_code, i18n.get('en', {}))
|
|
|
|
| 160 |
return {
|
| 161 |
title_md: gr.update(value=f"# {lang_map.get('app_title')}"),
|
| 162 |
subtitle_md: gr.update(value=lang_map.get('app_subtitle')),
|
|
|
|
| 174 |
step3_description_md: gr.update(value=lang_map.get('step3_description')),
|
| 175 |
continuity_director_checkbox: gr.update(label=lang_map.get('continuity_director_label')),
|
| 176 |
cinematographer_checkbox: gr.update(label=lang_map.get('cinematographer_label')),
|
| 177 |
+
|
| 178 |
+
# --- NOVOS CONTROLES ---
|
| 179 |
+
memoria_cinetica_radio: gr.update(label=lang_map.get('memoria_cinetica_label'), info=lang_map.get('memoria_cinetica_info')),
|
| 180 |
+
sobreposicao_video_slider: gr.update(label=lang_map.get('sobreposicao_label'), info=lang_map.get('sobreposicao_info')),
|
| 181 |
+
forca_guia_slider: gr.update(label=lang_map.get('forca_guia_label'), info=lang_map.get('forca_guia_info')),
|
| 182 |
+
convergencia_destino_slider: gr.update(label=lang_map.get('convergencia_final_label'), info=lang_map.get('convergencia_final_info')),
|
| 183 |
+
# --- FIM DOS NOVOS CONTROLES ---
|
| 184 |
+
|
| 185 |
produce_button: gr.update(value=lang_map.get('produce_button')),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
video_fragments_gallery: gr.update(label=lang_map.get('video_fragments_gallery_label')),
|
| 187 |
final_video_output: gr.update(label=lang_map.get('final_movie_with_audio_label')),
|
| 188 |
log_accordion: gr.update(label=lang_map.get('log_accordion_label')),
|
|
|
|
| 220 |
continuity_director_checkbox = gr.Checkbox(label=default_lang.get('continuity_director_label'), value=True)
|
| 221 |
cinematographer_checkbox = gr.Checkbox(label=default_lang.get('cinematographer_label'), value=True, visible=False)
|
| 222 |
|
| 223 |
+
gr.Markdown("--- \n**Controles de Continuidade e Edição (Novos):**")
|
| 224 |
with gr.Row():
|
| 225 |
+
# --- NOVOS CONTROLES ---
|
| 226 |
+
memoria_cinetica_radio = gr.Radio(choices=[8, 16, 24], value=8, label=default_lang.get('memoria_cinetica_label'), info=default_lang.get('memoria_cinetica_info'))
|
| 227 |
+
sobreposicao_video_slider = gr.Slider(label=default_lang.get('sobreposicao_label'), minimum=0, maximum=50, value=15, step=1, info=default_lang.get('sobreposicao_info'))
|
| 228 |
|
| 229 |
+
gr.Markdown("**Controle de Influência (Novos):**")
|
| 230 |
with gr.Row():
|
| 231 |
+
# --- NOVOS CONTROLES ---
|
| 232 |
+
forca_guia_slider = gr.Slider(label=default_lang.get('forca_guia_label'), minimum=0.0, maximum=1.0, value=0.5, step=0.05, info=default_lang.get('forca_guia_info'))
|
| 233 |
+
convergencia_destino_slider = gr.Slider(label=default_lang.get('convergencia_final_label'), minimum=0.0, maximum=1.0, value=0.75, step=0.05, info=default_lang.get('convergencia_final_info'))
|
| 234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 235 |
produce_button = gr.Button(default_lang.get('produce_button'), variant="primary")
|
| 236 |
|
| 237 |
video_fragments_gallery = gr.Gallery(label=default_lang.get('video_fragments_gallery_label'), visible=False, object_fit="contain", height="auto", type="filepath")
|
|
|
|
| 263 |
fn=run_video_production_wrapper,
|
| 264 |
inputs=[
|
| 265 |
keyframe_gallery, prompt_input, duration_per_fragment_slider,
|
| 266 |
+
# --- NOVOS CONTROLES ---
|
| 267 |
+
sobreposicao_video_slider,
|
| 268 |
+
memoria_cinetica_radio,
|
| 269 |
+
forca_guia_slider,
|
| 270 |
+
convergencia_destino_slider,
|
| 271 |
+
# --- FIM DOS NOVOS CONTROLES ---
|
| 272 |
resolution_selector, continuity_director_checkbox, cinematographer_checkbox
|
| 273 |
],
|
| 274 |
outputs=[video_fragments_gallery, final_video_output]
|