eeuuia commited on
Commit
82e06c6
·
verified ·
1 Parent(s): 76234aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -26
app.py CHANGED
@@ -40,7 +40,8 @@ def create_initial_state():
40
  def run_generate_low(prompt, neg_prompt, start_img, height, width, duration, cfg, seed, randomize_seed, progress=gr.Progress(track_tqdm=True)):
41
  """Executa a primeira etapa: geração de um vídeo base em baixa resolução."""
42
  print("UI: Chamando generate_low")
43
- try:
 
44
  conditioning_items = []
45
  if start_img:
46
  num_frames_estimate = int(duration * 24)
@@ -64,18 +65,11 @@ def run_generate_low(prompt, neg_prompt, start_img, height, width, duration, cfg
64
  }
65
 
66
  return video_path, new_state, gr.update(visible=True)
67
- except Exception as e:
68
- error_message = f"❌ Ocorreu um erro na Geração Base:\n{e}"
69
- print(f"{error_message}\nDetalhes: {traceback.format_exc()}")
70
- raise gr.Error(error_message)
71
-
72
  def run_ltx_refinement(state, prompt, neg_prompt, cfg, progress=gr.Progress(track_tqdm=True)):
73
  """Executa o processo de refinamento e upscaling de textura com o pipeline LTX."""
74
  print("UI: Chamando run_ltx_refinement (generate_upscale_denoise)")
75
- if not state or not state.get("low_res_latents"):
76
- raise gr.Error("Erro: Gere um vídeo base primeiro na Etapa 1.")
77
-
78
- try:
79
  video_path, tensor_path = video_generation_service.generate_upscale_denoise(
80
  latents_path=state["low_res_latents"],
81
  prompt=prompt,
@@ -89,22 +83,14 @@ def run_ltx_refinement(state, prompt, neg_prompt, cfg, progress=gr.Progress(trac
89
  state["refined_latents_ltx"] = tensor_path
90
 
91
  return video_path, state
92
- except Exception as e:
93
- error_message = f"❌ Ocorreu um erro durante o Refinamento LTX:\n{e}"
94
- print(f"{error_message}\nDetalhes: {traceback.format_exc()}")
95
- raise gr.Error(error_message)
96
-
97
  def run_seedvr_upscaling(state, seed, resolution, batch_size, fps, progress=gr.Progress(track_tqdm=True)):
98
  """Executa o processo de upscaling com SeedVR."""
99
- if not state or not state.get("low_res_video"):
100
- raise gr.Error("Erro: Gere um vídeo base primeiro na Etapa 1.")
101
- if not seedvr_inference_server:
102
- raise gr.Error("Erro: O servidor SeedVR não está disponível.")
103
-
104
  video_path = state["low_res_video"]
105
  print(f"▶️ Iniciando processo de upscaling SeedVR para o vídeo: {video_path}")
106
 
107
- try:
108
  def progress_wrapper(p, desc=""):
109
  progress(p, desc=desc)
110
  output_filepath = seedvr_inference_server.run_inference(
@@ -113,11 +99,7 @@ def run_seedvr_upscaling(state, seed, resolution, batch_size, fps, progress=gr.P
113
  )
114
  final_message = f"✅ Processo SeedVR concluído!\nVídeo salvo em: {output_filepath}"
115
  return gr.update(value=output_filepath, interactive=True), gr.update(value=final_message, interactive=False)
116
- except Exception as e:
117
- error_message = f"❌ Ocorreu um erro grave durante o upscaling com SeedVR:\n{e}"
118
- print(f"{error_message}\nDetalhes: {traceback.format_exc()}")
119
- return None, gr.update(value=error_message, interactive=False)
120
-
121
  # --- DEFINIÇÃO DA INTERFACE GRADIO ---
122
  with gr.Blocks() as demo:
123
  gr.Markdown("# LTX Video - Geração e Pós-Produção por Etapas")
 
40
  def run_generate_low(prompt, neg_prompt, start_img, height, width, duration, cfg, seed, randomize_seed, progress=gr.Progress(track_tqdm=True)):
41
  """Executa a primeira etapa: geração de um vídeo base em baixa resolução."""
42
  print("UI: Chamando generate_low")
43
+
44
+ if True:
45
  conditioning_items = []
46
  if start_img:
47
  num_frames_estimate = int(duration * 24)
 
65
  }
66
 
67
  return video_path, new_state, gr.update(visible=True)
68
+
 
 
 
 
69
  def run_ltx_refinement(state, prompt, neg_prompt, cfg, progress=gr.Progress(track_tqdm=True)):
70
  """Executa o processo de refinamento e upscaling de textura com o pipeline LTX."""
71
  print("UI: Chamando run_ltx_refinement (generate_upscale_denoise)")
72
+ if True:
 
 
 
73
  video_path, tensor_path = video_generation_service.generate_upscale_denoise(
74
  latents_path=state["low_res_latents"],
75
  prompt=prompt,
 
83
  state["refined_latents_ltx"] = tensor_path
84
 
85
  return video_path, state
86
+
 
 
 
 
87
  def run_seedvr_upscaling(state, seed, resolution, batch_size, fps, progress=gr.Progress(track_tqdm=True)):
88
  """Executa o processo de upscaling com SeedVR."""
89
+
 
 
 
 
90
  video_path = state["low_res_video"]
91
  print(f"▶️ Iniciando processo de upscaling SeedVR para o vídeo: {video_path}")
92
 
93
+ if True:
94
  def progress_wrapper(p, desc=""):
95
  progress(p, desc=desc)
96
  output_filepath = seedvr_inference_server.run_inference(
 
99
  )
100
  final_message = f"✅ Processo SeedVR concluído!\nVídeo salvo em: {output_filepath}"
101
  return gr.update(value=output_filepath, interactive=True), gr.update(value=final_message, interactive=False)
102
+
 
 
 
 
103
  # --- DEFINIÇÃO DA INTERFACE GRADIO ---
104
  with gr.Blocks() as demo:
105
  gr.Markdown("# LTX Video - Geração e Pós-Produção por Etapas")