Spaces:
Paused
Paused
Rename app (1).py to app _ltx.py
Browse files- app (1).py → app _ltx.py +10 -18
app (1).py → app _ltx.py
RENAMED
|
@@ -5,18 +5,13 @@ from PIL import Image
|
|
| 5 |
import os
|
| 6 |
import imageio
|
| 7 |
from api.ltx_server import video_generation_service
|
| 8 |
-
|
| 9 |
-
|
| 10 |
from huggingface_hub import logging
|
| 11 |
|
| 12 |
-
|
| 13 |
logging.set_verbosity_error()
|
| 14 |
logging.set_verbosity_warning()
|
| 15 |
logging.set_verbosity_info()
|
| 16 |
logging.set_verbosity_debug()
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
# --- FUNÇÕES DE AJUDA PARA A UI ---
|
| 21 |
# ... (calculate_new_dimensions e handle_media_upload_for_dims permanecem as mesmas) ...
|
| 22 |
TARGET_FIXED_SIDE = 768
|
|
@@ -61,7 +56,6 @@ def update_frame_slider(duration):
|
|
| 61 |
new_value = 48 if max_frames >= 48 else max_frames // 2
|
| 62 |
return gr.update(maximum=max_frames, value=new_value)
|
| 63 |
|
| 64 |
-
|
| 65 |
# --- FUNÇÃO WRAPPER PARA CHAMAR O SERVIÇO ---
|
| 66 |
def gradio_generate_wrapper(
|
| 67 |
prompt, negative_prompt, mode,
|
|
@@ -115,15 +109,16 @@ with gr.Blocks(css=css) as demo:
|
|
| 115 |
with gr.Column(scale=1):
|
| 116 |
gr.Markdown("#### Início (Obrigatório)")
|
| 117 |
start_image_i2v = gr.Image(label="Imagem de Início", type="filepath", sources=["upload", "clipboard"])
|
| 118 |
-
with gr.
|
| 119 |
-
gr.
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
gr.
|
| 125 |
-
|
| 126 |
-
|
|
|
|
| 127 |
|
| 128 |
i2v_button = gr.Button("Generate Image-to-Video", variant="primary")
|
| 129 |
|
|
@@ -164,9 +159,6 @@ with gr.Blocks(css=css) as demo:
|
|
| 164 |
text_tab.select(fn=lambda: "text-to-video", outputs=[mode])
|
| 165 |
video_tab.select(fn=lambda: "video-to-video", outputs=[mode])
|
| 166 |
|
| 167 |
-
# --- <INÍCIO DA CORREÇÃO> ---
|
| 168 |
-
# Reescrevendo as listas de inputs de forma explícita para evitar erros.
|
| 169 |
-
|
| 170 |
# Placeholders para os botões que não usam certos inputs
|
| 171 |
none_image = gr.Textbox(visible=False, value=None)
|
| 172 |
none_video = gr.Textbox(visible=False, value=None)
|
|
|
|
| 5 |
import os
|
| 6 |
import imageio
|
| 7 |
from api.ltx_server import video_generation_service
|
|
|
|
|
|
|
| 8 |
from huggingface_hub import logging
|
| 9 |
|
|
|
|
| 10 |
logging.set_verbosity_error()
|
| 11 |
logging.set_verbosity_warning()
|
| 12 |
logging.set_verbosity_info()
|
| 13 |
logging.set_verbosity_debug()
|
| 14 |
|
|
|
|
|
|
|
| 15 |
# --- FUNÇÕES DE AJUDA PARA A UI ---
|
| 16 |
# ... (calculate_new_dimensions e handle_media_upload_for_dims permanecem as mesmas) ...
|
| 17 |
TARGET_FIXED_SIDE = 768
|
|
|
|
| 56 |
new_value = 48 if max_frames >= 48 else max_frames // 2
|
| 57 |
return gr.update(maximum=max_frames, value=new_value)
|
| 58 |
|
|
|
|
| 59 |
# --- FUNÇÃO WRAPPER PARA CHAMAR O SERVIÇO ---
|
| 60 |
def gradio_generate_wrapper(
|
| 61 |
prompt, negative_prompt, mode,
|
|
|
|
| 109 |
with gr.Column(scale=1):
|
| 110 |
gr.Markdown("#### Início (Obrigatório)")
|
| 111 |
start_image_i2v = gr.Image(label="Imagem de Início", type="filepath", sources=["upload", "clipboard"])
|
| 112 |
+
with gr.Accordion("Imagens condicionais opcional", open=False):
|
| 113 |
+
with gr.Column(scale=1):
|
| 114 |
+
gr.Markdown("#### Meio (Opcional)")
|
| 115 |
+
middle_image_i2v = gr.Image(label="Imagem do Meio", type="filepath", sources=["upload", "clipboard"])
|
| 116 |
+
middle_frame_i2v = gr.Slider(label="Frame Alvo", minimum=0, maximum=200, step=1, value=48)
|
| 117 |
+
middle_weight_i2v = gr.Slider(label="Peso/Força", minimum=0.0, maximum=1.0, step=0.05, value=1.0)
|
| 118 |
+
with gr.Column(scale=1):
|
| 119 |
+
gr.Markdown("#### Fim (Opcional)")
|
| 120 |
+
end_image_i2v = gr.Image(label="Imagem de Fim", type="filepath", sources=["upload", "clipboard"])
|
| 121 |
+
end_weight_i2v = gr.Slider(label="Peso/Força", minimum=0.0, maximum=1.0, step=0.05, value=1.0)
|
| 122 |
|
| 123 |
i2v_button = gr.Button("Generate Image-to-Video", variant="primary")
|
| 124 |
|
|
|
|
| 159 |
text_tab.select(fn=lambda: "text-to-video", outputs=[mode])
|
| 160 |
video_tab.select(fn=lambda: "video-to-video", outputs=[mode])
|
| 161 |
|
|
|
|
|
|
|
|
|
|
| 162 |
# Placeholders para os botões que não usam certos inputs
|
| 163 |
none_image = gr.Textbox(visible=False, value=None)
|
| 164 |
none_video = gr.Textbox(visible=False, value=None)
|