euiia commited on
Commit
fd9e113
·
verified ·
1 Parent(s): 640c04f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -13
app.py CHANGED
@@ -2,7 +2,7 @@
2
  #
3
  # Copyright (C) August 4, 2025 Carlos Rodrigues dos Santos
4
  #
5
- # Version: 2.0.1
6
  #
7
  # Contact:
8
  # Carlos Rodrigues dos Santos
@@ -194,8 +194,8 @@ def run_upscaler_wrapper(latent_paths, chunk_size, progress=gr.Progress()):
194
  }
195
 
196
  final_path = None
197
- for path in aduc.task_run_latent_upscaler(latent_paths, int(chunk_size), progress=progress):
198
- final_path = path['final_path']
199
 
200
  yield {
201
  upscaler_video_output: gr.update(value=final_path, label="✅ Latent Upscale Complete"),
@@ -215,8 +215,8 @@ def run_hd_wrapper(source_video, model_version, steps, global_prompt, progress=g
215
  }
216
 
217
  final_path = None
218
- for path in aduc.task_run_hd_mastering(source_video, model_version, int(steps), global_prompt, progress=progress):
219
- final_path = path['final_path']
220
 
221
  yield {
222
  hd_video_output: gr.update(value=final_path, label="✅ HD Mastering Complete"),
@@ -238,8 +238,8 @@ def run_audio_wrapper(source_video, audio_prompt, global_prompt, progress=gr.Pro
238
  final_audio_prompt = audio_prompt if audio_prompt and audio_prompt.strip() else global_prompt
239
 
240
  final_path = None
241
- for path in aduc.task_run_audio_generation(source_video, final_audio_prompt, progress=progress):
242
- final_path = path['final_path']
243
 
244
  yield {
245
  audio_video_output: gr.update(value=final_path, label="✅ Audio Generation Complete"),
@@ -258,9 +258,11 @@ def update_ui_language(lang_emoji):
258
  lang_code = lang_code_map.get(lang_emoji, "en")
259
  lang_map = i18n.get(lang_code, i18n.get('en', {}))
260
  return {
 
261
  title_md: gr.update(value=f"# {lang_map.get('app_title')}"),
262
  subtitle_md: gr.update(value=lang_map.get('app_subtitle')),
263
  lang_selector: gr.update(label=lang_map.get('lang_selector_label')),
 
264
  step1_accordion: gr.update(label=lang_map.get('step1_accordion')),
265
  prompt_input: gr.update(label=lang_map.get('prompt_label')),
266
  ref_image_input: gr.update(label=lang_map.get('ref_images_label')),
@@ -271,6 +273,7 @@ def update_ui_language(lang_emoji):
271
  step1_mode_b_info_md: gr.update(value=f"*{lang_map.get('step1_mode_b_info')}*"),
272
  storyboard_output: gr.update(label=lang_map.get('storyboard_output_label')),
273
  keyframe_gallery: gr.update(label=lang_map.get('keyframes_gallery_label')),
 
274
  step3_accordion: gr.update(label=lang_map.get('step3_accordion')),
275
  step3_description_md: gr.update(value=lang_map.get('step3_description')),
276
  produce_original_button: gr.update(value=lang_map.get('produce_original_button')),
@@ -283,6 +286,7 @@ def update_ui_language(lang_emoji):
283
  guidance_scale_slider: gr.update(label=lang_map.get('guidance_scale_label'), info=lang_map.get('guidance_scale_info')),
284
  stg_scale_slider: gr.update(label=lang_map.get('stg_scale_label'), info=lang_map.get('stg_scale_info')),
285
  inference_steps_slider: gr.update(label=lang_map.get('steps_label'), info=lang_map.get('steps_info')),
 
286
  step4_accordion: gr.update(label=lang_map.get('step4_accordion')),
287
  step4_description_md: gr.update(value=lang_map.get('step4_description')),
288
  sub_step_a_accordion: gr.update(label=lang_map.get('sub_step_a_upscaler')),
@@ -301,6 +305,7 @@ def update_ui_language(lang_emoji):
301
  audio_options_accordion: gr.update(label=lang_map.get('audio_options')),
302
  audio_prompt_input: gr.update(label=lang_map.get('audio_prompt_label'), info=lang_map.get('audio_prompt_info')),
303
  run_audio_button: gr.update(value=lang_map.get('run_audio_button')),
 
304
  final_video_output: gr.update(label=lang_map.get('final_video_label')),
305
  log_accordion: gr.update(label=lang_map.get('log_accordion_label')),
306
  log_display: gr.update(label=lang_map.get('log_display_label')),
@@ -311,21 +316,18 @@ def update_ui_language(lang_emoji):
311
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
312
  default_lang = i18n.get('pt', {})
313
 
314
- # State components
315
  original_latents_paths_state = gr.State(value=None)
316
  original_video_path_state = gr.State(value=None)
317
  upscaled_video_path_state = gr.State(value=None)
318
  hd_video_path_state = gr.State(value=None)
319
  current_source_video_state = gr.State(value=None)
320
 
321
- # UI Header
322
  title_md = gr.Markdown(f"# {default_lang.get('app_title')}")
323
  subtitle_md = gr.Markdown(default_lang.get('app_subtitle'))
324
  with gr.Row():
325
  lang_selector = gr.Radio(["🇧🇷", "🇺🇸", "🇨🇳"], value="🇧🇷", label=default_lang.get('lang_selector_label'))
326
  resolution_selector = gr.Radio(["480x480", "720x720", "960x960"], value="480x480", label="Base Resolution")
327
 
328
- # Step 1 & 2: Pre-Production
329
  with gr.Accordion(default_lang.get('step1_accordion'), open=True) as step1_accordion:
330
  prompt_input = gr.Textbox(label=default_lang.get('prompt_label'), value="A majestic lion walks across the savanna, sits down, and then roars at the setting sun.")
331
  ref_image_input = gr.File(label=default_lang.get('ref_images_label'), file_count="multiple", file_types=["image"])
@@ -339,7 +341,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
339
  storyboard_output = gr.JSON(label=default_lang.get('storyboard_output_label'))
340
  keyframe_gallery = gr.Gallery(label=default_lang.get('keyframes_gallery_label'), visible=True, object_fit="contain", height="auto", type="filepath")
341
 
342
- # Step 3: Production
343
  with gr.Accordion(default_lang.get('step3_accordion'), open=False, visible=False) as step3_accordion:
344
  step3_description_md = gr.Markdown(default_lang.get('step3_description'))
345
  with gr.Accordion(default_lang.get('ltx_advanced_options'), open=False) as ltx_advanced_options_accordion:
@@ -356,7 +357,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
356
  produce_original_button = gr.Button(default_lang.get('produce_original_button'), variant="primary")
357
  original_video_output = gr.Video(label="Original Master Video", visible=False, interactive=False)
358
 
359
- # Step 4: Post-Production
360
  with gr.Accordion(default_lang.get('step4_accordion'), open=False, visible=False) as step4_accordion:
361
  step4_description_md = gr.Markdown(default_lang.get('step4_description'))
362
  with gr.Accordion(default_lang.get('sub_step_a_upscaler'), open=True) as sub_step_a_accordion:
@@ -379,7 +379,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
379
  run_audio_button = gr.Button(default_lang.get('run_audio_button'), variant="secondary")
380
  audio_video_output = gr.Video(label="Video with Audio", visible=False, interactive=False)
381
 
382
- # Final Output & Logs
383
  final_video_output = gr.Video(label=default_lang.get('final_video_label'), visible=False, interactive=False)
384
  with gr.Accordion(default_lang.get('log_accordion_label'), open=False) as log_accordion:
385
  log_display = gr.Textbox(label=default_lang.get('log_display_label'), lines=20, interactive=False, autoscroll=True)
 
2
  #
3
  # Copyright (C) August 4, 2025 Carlos Rodrigues dos Santos
4
  #
5
+ # Version: 2.0.2
6
  #
7
  # Contact:
8
  # Carlos Rodrigues dos Santos
 
194
  }
195
 
196
  final_path = None
197
+ for update in aduc.task_run_latent_upscaler(latent_paths, int(chunk_size), progress=progress):
198
+ final_path = update['final_path']
199
 
200
  yield {
201
  upscaler_video_output: gr.update(value=final_path, label="✅ Latent Upscale Complete"),
 
215
  }
216
 
217
  final_path = None
218
+ for update in aduc.task_run_hd_mastering(source_video, model_version, int(steps), global_prompt, progress=progress):
219
+ final_path = update['final_path']
220
 
221
  yield {
222
  hd_video_output: gr.update(value=final_path, label="✅ HD Mastering Complete"),
 
238
  final_audio_prompt = audio_prompt if audio_prompt and audio_prompt.strip() else global_prompt
239
 
240
  final_path = None
241
+ for update in aduc.task_run_audio_generation(source_video, final_audio_prompt, progress=progress):
242
+ final_path = update['final_path']
243
 
244
  yield {
245
  audio_video_output: gr.update(value=final_path, label="✅ Audio Generation Complete"),
 
258
  lang_code = lang_code_map.get(lang_emoji, "en")
259
  lang_map = i18n.get(lang_code, i18n.get('en', {}))
260
  return {
261
+ # General
262
  title_md: gr.update(value=f"# {lang_map.get('app_title')}"),
263
  subtitle_md: gr.update(value=lang_map.get('app_subtitle')),
264
  lang_selector: gr.update(label=lang_map.get('lang_selector_label')),
265
+ # Step 1: Pre-Production
266
  step1_accordion: gr.update(label=lang_map.get('step1_accordion')),
267
  prompt_input: gr.update(label=lang_map.get('prompt_label')),
268
  ref_image_input: gr.update(label=lang_map.get('ref_images_label')),
 
273
  step1_mode_b_info_md: gr.update(value=f"*{lang_map.get('step1_mode_b_info')}*"),
274
  storyboard_output: gr.update(label=lang_map.get('storyboard_output_label')),
275
  keyframe_gallery: gr.update(label=lang_map.get('keyframes_gallery_label')),
276
+ # Step 3: Production
277
  step3_accordion: gr.update(label=lang_map.get('step3_accordion')),
278
  step3_description_md: gr.update(value=lang_map.get('step3_description')),
279
  produce_original_button: gr.update(value=lang_map.get('produce_original_button')),
 
286
  guidance_scale_slider: gr.update(label=lang_map.get('guidance_scale_label'), info=lang_map.get('guidance_scale_info')),
287
  stg_scale_slider: gr.update(label=lang_map.get('stg_scale_label'), info=lang_map.get('stg_scale_info')),
288
  inference_steps_slider: gr.update(label=lang_map.get('steps_label'), info=lang_map.get('steps_info')),
289
+ # Step 4: Post-Production
290
  step4_accordion: gr.update(label=lang_map.get('step4_accordion')),
291
  step4_description_md: gr.update(value=lang_map.get('step4_description')),
292
  sub_step_a_accordion: gr.update(label=lang_map.get('sub_step_a_upscaler')),
 
305
  audio_options_accordion: gr.update(label=lang_map.get('audio_options')),
306
  audio_prompt_input: gr.update(label=lang_map.get('audio_prompt_label'), info=lang_map.get('audio_prompt_info')),
307
  run_audio_button: gr.update(value=lang_map.get('run_audio_button')),
308
+ # Final Outputs & Logs
309
  final_video_output: gr.update(label=lang_map.get('final_video_label')),
310
  log_accordion: gr.update(label=lang_map.get('log_accordion_label')),
311
  log_display: gr.update(label=lang_map.get('log_display_label')),
 
316
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
317
  default_lang = i18n.get('pt', {})
318
 
 
319
  original_latents_paths_state = gr.State(value=None)
320
  original_video_path_state = gr.State(value=None)
321
  upscaled_video_path_state = gr.State(value=None)
322
  hd_video_path_state = gr.State(value=None)
323
  current_source_video_state = gr.State(value=None)
324
 
 
325
  title_md = gr.Markdown(f"# {default_lang.get('app_title')}")
326
  subtitle_md = gr.Markdown(default_lang.get('app_subtitle'))
327
  with gr.Row():
328
  lang_selector = gr.Radio(["🇧🇷", "🇺🇸", "🇨🇳"], value="🇧🇷", label=default_lang.get('lang_selector_label'))
329
  resolution_selector = gr.Radio(["480x480", "720x720", "960x960"], value="480x480", label="Base Resolution")
330
 
 
331
  with gr.Accordion(default_lang.get('step1_accordion'), open=True) as step1_accordion:
332
  prompt_input = gr.Textbox(label=default_lang.get('prompt_label'), value="A majestic lion walks across the savanna, sits down, and then roars at the setting sun.")
333
  ref_image_input = gr.File(label=default_lang.get('ref_images_label'), file_count="multiple", file_types=["image"])
 
341
  storyboard_output = gr.JSON(label=default_lang.get('storyboard_output_label'))
342
  keyframe_gallery = gr.Gallery(label=default_lang.get('keyframes_gallery_label'), visible=True, object_fit="contain", height="auto", type="filepath")
343
 
 
344
  with gr.Accordion(default_lang.get('step3_accordion'), open=False, visible=False) as step3_accordion:
345
  step3_description_md = gr.Markdown(default_lang.get('step3_description'))
346
  with gr.Accordion(default_lang.get('ltx_advanced_options'), open=False) as ltx_advanced_options_accordion:
 
357
  produce_original_button = gr.Button(default_lang.get('produce_original_button'), variant="primary")
358
  original_video_output = gr.Video(label="Original Master Video", visible=False, interactive=False)
359
 
 
360
  with gr.Accordion(default_lang.get('step4_accordion'), open=False, visible=False) as step4_accordion:
361
  step4_description_md = gr.Markdown(default_lang.get('step4_description'))
362
  with gr.Accordion(default_lang.get('sub_step_a_upscaler'), open=True) as sub_step_a_accordion:
 
379
  run_audio_button = gr.Button(default_lang.get('run_audio_button'), variant="secondary")
380
  audio_video_output = gr.Video(label="Video with Audio", visible=False, interactive=False)
381
 
 
382
  final_video_output = gr.Video(label=default_lang.get('final_video_label'), visible=False, interactive=False)
383
  with gr.Accordion(default_lang.get('log_accordion_label'), open=False) as log_accordion:
384
  log_display = gr.Textbox(label=default_lang.get('log_display_label'), lines=20, interactive=False, autoscroll=True)