File size: 28,859 Bytes
70b382b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
import os
import subprocess
from PIL import Image
import gradio as gr
import cv2
# Codigo creado por IA(Sistema de Interes) https://www.youtube.com/@IA.Sistema.de.Interes
# Funci贸n para ejecutar comandos y devolver el estado
def run_commands(description, aspect_ratio, enhance_check, model, style, upscale_check, task_type, img=None, is_extend=False, is_recreate=False):
try:
commands = []
if True:
# Comandos generales seg煤n el tipo de tarea
if upscale_check:
commands.append('python /content/Vidu_Studio/vidu_credit.py --credit 4')
else:
commands.append('python /content/Vidu_Studio/vidu_credit.py --credit 0')
if task_type == "video_to_video":
commands.append('python /content/Vidu_Studio/utils/video_fragment.py')
print("File Uploader...")
commands.append('python /content/Vidu_Studio/upload/file_uploader.py --file_info "file_info" --image "img_fragmento"')
if task_type == "extend":
print("Last frame...")
commands.append('python /content/Vidu_Studio/utils/fragment.py')
if task_type == "reference_to_video" or task_type == "image_to_video" or task_type == "extend":
print("File Uploader...")
commands.append('python /content/Vidu_Studio/upload/file_uploader.py --file_info "file_info" --image "img_fragmento"')
if task_type == "reference_to_video":
print("Generating video with reference...")
commands.append(
f'python /content/Vidu_Studio/create_video_reference.py --prompt "{description}" --enhance {str(enhance_check).lower()} --model "{model}"'
)
elif task_type == "text_to_video":
print("Generating video: Text to Video...")
commands.append(
f'python /content/Vidu_Studio/create_text_to_video.py --prompt "{description}" --enhance {str(enhance_check).lower()} --model "{model}" --style "{style}" --aspect_ratio "{aspect_ratio}"'
)
elif task_type == "image_to_video" or task_type == "extend":
print("Generating Video: Image to Video...")
commands.append(
f'python /content/Vidu_Studio/create_task.py --prompt "{description}" --enhance {str(enhance_check).lower()} --model "{model}"'
)
elif task_type == "video_to_video":
print("Generating Video: Video to Video...")
commands.append(
f'python /content/Vidu_Studio/create_task.py --prompt "{description}" --enhance {str(enhance_check).lower()} --model "{model}"'
)
else:
raise ValueError(f"Tipo de tarea no reconocido: {task_type}")
print("Video in progress...")
commands.append('python /content/Vidu_Studio/utils/process_task.py')
if upscale_check:
print("Generate Upscale...")
commands.append('python /content/Vidu_Studio/utils/upscale_task.py')
print("Upscale in progress...")
commands.append('python /content/Vidu_Studio/utils/process_task_upscale.py')
commands.append('python /content/Vidu_Studio/utils/delete_task.py')
commands.append('python /content/Vidu_Studio/utils/delete_task_upscale.py')
else:
commands.append('python /content/Vidu_Studio/utils/delete_task.py')
output = ""
for command in commands:
result = subprocess.run(command, shell=True, capture_output=True, text=True)
output += f"Exit:\n{result.stdout}\n"
print(result.stdout)
video_path = "/content/Vidu_Studio/video.mp4"
return output, video_path
except Exception as e:
return f"Excepci贸n: {str(e)}", None
def run_commands_dual(description, aspect_ratio, enhance_check, model, style, upscale_check, task_type, add_end_frame, img=None, is_extend=False, is_recreate=False):
try:
commands = []
if add_end_frame:
# Comandos generales seg煤n el tipo de tarea
if upscale_check:
commands.append('python /content/Vidu_Studio/vidu_credit.py --credit 4')
else:
commands.append('python /content/Vidu_Studio/vidu_credit.py --credit 0')
print("File Uploader...")
commands.append('python /content/Vidu_Studio/upload/file_uploader.py --file_info "file_info" --image "img_fragmento"')
commands.append('python /content/Vidu_Studio/upload/file_uploader.py --file_info "file_info2" --image "img_fragmento2"')
if task_type == "headtailimg2video":
print("Generating video with headtailimg2video...")
commands.append(
f'python /content/Vidu_Studio/headtailimg2video.py --prompt "{description}" --enhance {str(enhance_check).lower()} --model "{model}"'
)
print("Video in progress...")
commands.append('python /content/Vidu_Studio/utils/process_task.py')
if upscale_check:
print("Generate Upscale...")
commands.append('python /content/Vidu_Studio/utils/upscale_task.py')
print("Upscale in progress...")
commands.append('python /content/Vidu_Studio/utils/process_task_upscale.py')
commands.append('python /content/Vidu_Studio/utils/delete_task.py')
commands.append('python /content/Vidu_Studio/utils/delete_task_upscale.py')
else:
commands.append('python /content/Vidu_Studio/utils/delete_task.py')
else:
# Comandos generales seg煤n el tipo de tarea
if upscale_check:
commands.append('python /content/Vidu_Studio/vidu_credit.py --credit 4')
else:
commands.append('python /content/Vidu_Studio/vidu_credit.py --credit 0')
print("File Uploader...")
commands.append('python /content/Vidu_Studio/upload/file_uploader.py --file_info "file_info" --image "img_fragmento"')
if task_type == "headtailimg2video":
print("Generating video with Image to Video...")
commands.append(
f'python /content/Vidu_Studio/create_task.py --prompt "{description}" --enhance {str(enhance_check).lower()} --model "{model}"'
)
print("Video in progress...")
commands.append('python /content/Vidu_Studio/utils/process_task.py')
if upscale_check:
print("Generate Upscale...")
commands.append('python /content/Vidu_Studio/utils/upscale_task.py')
print("Upscale in progress...")
commands.append('python /content/Vidu_Studio/utils/process_task_upscale.py')
commands.append('python /content/Vidu_Studio/utils/delete_task.py')
commands.append('python /content/Vidu_Studio/utils/delete_task_upscale.py')
else:
commands.append('python /content/Vidu_Studio/utils/delete_task.py')
output = ""
for command in commands:
result = subprocess.run(command, shell=True, capture_output=True, text=True)
output += f"Exit:\n{result.stdout}\n"
print(result.stdout)
video_path = "/content/Vidu_Studio/video.mp4"
return output, video_path
except Exception as e:
return f"Excepci贸n: {str(e)}", None
# Funci贸n para procesar y guardar la imagen autom谩ticamente en formato JPG
def process_and_save_image(image, coordinates_file_path="/tmp/coordinates.txt"):
jpg_path = "/tmp/img_fragmento.jpg"
try:
if image.format != "JPEG":
image = image.convert("RGB")
image.save(jpg_path, "JPEG", quality=100)
if os.path.exists(jpg_path):
print(f"Imagen guardada correctamente")
# Obtener las dimensiones de la imagen
width, height = image.size
# Guardar las coordenadas en un archivo de texto
with open(coordinates_file_path, "w") as file:
file.write(f"X: {width}\n")
file.write(f"Y: {height}\n")
print(f"Coordenadas guardadas correctamente")
return None
except Exception as e:
print(f"Error al procesar la imagen: {str(e)}")
return None
# Funci贸n para procesar y guardar la imagen autom谩ticamente en formato JPG
def process_and_save_image1(image, coordinates_file_path="/tmp/coordinates.txt"):
jpg_path = "/tmp/img_fragmento.jpg"
try:
if image.format != "JPEG":
image = image.convert("RGB")
image.save(jpg_path, "JPEG", quality=100)
if os.path.exists(jpg_path):
print(f"Imagen guardada correctamente")
# Obtener las dimensiones de la imagen
width, height = image.size
# Guardar las coordenadas en un archivo de texto
with open(coordinates_file_path, "w") as file:
file.write(f"X: {width}\n")
file.write(f"Y: {height}\n")
print(f"Coordenadas guardadas correctamente")
return None
except Exception as e:
print(f"Error al procesar la imagen: {str(e)}")
return None
# Funci贸n para procesar y guardar la imagen autom谩ticamente en formato JPG
def process_and_save_image2(image, coordinates_file_path="/tmp/coordinates2.txt"):
jpg_path = "/tmp/img_fragmento2.jpg"
try:
if image.format != "JPEG":
image = image.convert("RGB")
image.save(jpg_path, "JPEG", quality=100)
if os.path.exists(jpg_path):
print(f"Imagen guardada correctamente")
# Obtener las dimensiones de la imagen
width, height = image.size
# Guardar las coordenadas en un archivo de texto
with open(coordinates_file_path, "w") as file:
file.write(f"X: {width}\n")
file.write(f"Y: {height}\n")
print(f"Coordenadas guardadas correctamente")
except Exception as e:
print(f"Error al procesar la imagen: {str(e)}")
# Funci贸n para obtener el 煤ltimo frame de un video
def get_last_frame(video_path):
try:
cap = cv2.VideoCapture(video_path)
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
cap.set(cv2.CAP_PROP_POS_FRAMES, frame_count - 1)
ret, frame = cap.read()
cap.release()
if ret:
return Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
else:
print(f"Error al leer el 煤ltimo frame del video: {video_path}")
return None
except Exception as e:
print(f"Excepci贸n al obtener el 煤ltimo frame: {str(e)}")
return None
# Funci贸n para ejecutar los comandos de guardado
def run_save_commands():
try:
print("Rendering video...")
commands = [
"python /content/Vidu_Studio/utils/fragment.py",
"python /content/Vidu_Studio/utils/union.py"
]
output = ""
for command in commands:
result = subprocess.run(command, shell=True, capture_output=True, text=True)
output += f"Exit:\n{result.stdout}\n"
print(result.stdout)
video_path = "/content/Vidu_Studio/video.mp4"
return output, video_path
except Exception as e:
return f"Excepci贸n al guardar: {str(e)}", None
# Funci贸n para mostrar o ocultar el segundo cuadro de imagen
def activar_end_frame(activar):
return gr.update(visible=activar)
# Definir la interfaz
with gr.Blocks() as demo:
# Agregar un t铆tulo en grande al inicio de la interfaz
gr.HTML(f"<h1 style='text-align: center; font-size: 3em;'>VIDU STUDIO 3.0 - AUTOMATIC</p>Created by:<a href='https://www.youtube.com/@IA.Sistema.de.Interes' target='_blank'>IA(Sistema de Inter茅s)</a></p>")
with gr.Tabs():
# Primera pesta帽a: Image to Video
with gr.Tab("Image to Video"):
with gr.Row():
with gr.Column():
add_end_frame = gr.Checkbox(label="Add End Frame", value=False)
# Fila para mostrar ambas im谩genes cuando se activa
with gr.Row():
# Imagen de inicio (carga de archivo)
img1 = gr.Image(type="pil", label="Drag image here or select image", interactive=True,
elem_id="img1", width=200, height=200) # Ajustar tama帽o de la imagen
# Imagen de fin (se oculta inicialmente)
img2 = gr.Image(type="pil", label="Upload the last frame image", interactive=True,
elem_id="img2", visible=False, width=200, height=200) # Ajustar tama帽o de la imagen
description_input = gr.Textbox(label="Prompt",
placeholder="Aqu铆 va una caja de texto editable para el prompt",
elem_id="description_input")
enhance_checkbox = gr.Checkbox(label="Enhance prompt", value=False, elem_id="enhance_checkbox")
model_dropdown = gr.Dropdown(
choices=["vidu-1", "vidu-high-performance"],
label="Model",
value="vidu-1",
elem_id="model_dropdown"
)
upscale_checkbox = gr.Checkbox(label="Upscale", value=False, elem_id="upscale_checkbox")
create_button = gr.Button("Create", elem_id="create_button")
extend_button = gr.Button("Extend", elem_id="extend_button")
recreate_button = gr.Button("Re-create", elem_id="recreate_button") # Nuevo bot贸n "Re-create"
save_button = gr.Button("Save", elem_id="save_button") # Bot贸n de guardado
with gr.Column():
video_output = gr.Video(label="Video Output Image to Video", height=400, elem_id="video_output_image_to_video")
output_textbox = gr.Textbox(label="Output", interactive=False, elem_id="output_textbox") # Cambia el nombre del textbox
# L贸gica para mostrar el segundo cuadro de imagen al activar el checkbox
add_end_frame.change(activar_end_frame, add_end_frame, img2)
# Procesar la imagen autom谩ticamente cuando se carga
img1.change(
fn=process_and_save_image1,
inputs=img1,
outputs=[]
)
img2.change(
fn=process_and_save_image2,
inputs=img2,
outputs=[]
)
# Bot贸n "Create" y su salida
create_button.click(
fn=lambda desc, enhance, model, upscale, img, add_end: run_commands_dual(desc, "16:9", enhance, model, "general", upscale, task_type="headtailimg2video", img=img, add_end_frame=add_end),
inputs=[description_input, enhance_checkbox, model_dropdown, upscale_checkbox, img1, add_end_frame], # A帽ade el Checkbox aqu铆
outputs=[output_textbox, video_output] # Aseg煤rate de tener definidos estos componentes de salida
)
# Bot贸n "Extend" y su salida
extend_button.click(
fn=lambda desc, enhance, model, upscale, img: run_commands(desc, "16:9", enhance, model, "general", upscale, task_type="extend", img=img, is_extend=True), # Agrega img como argumento
inputs=[description_input, enhance_checkbox, model_dropdown, upscale_checkbox, img1], # Agrega image_input a la lista de inputs
outputs=[output_textbox, video_output]
)
# Bot贸n "Re-create" y su salida
recreate_button.click(
fn=lambda desc, enhance, model, upscale, img: run_commands(desc, "16:9", enhance, model, "general", upscale, task_type="image_to_video", img=img, is_recreate=True), # Agrega img como argumento
inputs=[description_input, enhance_checkbox, model_dropdown, upscale_checkbox, img1], # Agrega image_input a la lista de inputs
outputs=[output_textbox, video_output]
)
# Bot贸n "Save" y su salida
save_button.click(
fn=run_save_commands,
inputs=[],
outputs=[output_textbox, video_output]
)
# Segunda pesta帽a: Reference to Video
with gr.Tab("Reference to Video"):
with gr.Row():
with gr.Column():
image_input2 = gr.Image(type="pil", label="Drag image here or select image", interactive=True,
elem_id="image_input2")
description_input2 = gr.Textbox(label="Prompt",
placeholder="Enter text to begin creating a video that aligns with the subject of the image",
elem_id="description_input2")
enhance_checkbox2 = gr.Checkbox(label="Enhance prompt", value=False, elem_id="enhance_checkbox2")
model_dropdown2 = gr.Dropdown(
choices=["vidu-1", "vidu-high-performance"],
label="Model",
value="vidu-1",
elem_id="model_dropdown2"
)
upscale_checkbox2 = gr.Checkbox(label="Upscale", value=False, elem_id="upscale_checkbox2")
create_button2 = gr.Button("Create", elem_id="create_button2")
extend_button2 = gr.Button("Extend", elem_id="extend_button2")
recreate_button2 = gr.Button("Re-create", elem_id="recreate_button2") # Nuevo bot贸n "Re-create"
save_button2 = gr.Button("Save", elem_id="save_button2") # Bot贸n de guardado
with gr.Column():
video_output2 = gr.Video(label="Video Output Reference to Video", height=400, elem_id="video_output_reference_to_video")
output_textbox2 = gr.Textbox(label="Output", interactive=False, elem_id="output_textbox2") # Cambia el nombre del textbox
# Procesar la imagen autom谩ticamente cuando se carga
image_input2.change(
fn=process_and_save_image,
inputs=image_input2,
outputs=[]
)
# Bot贸n "Create" y su salida
create_button2.click(
fn=lambda desc, enhance, model, upscale, img: run_commands(desc, "16:9", enhance, model, "general", upscale, task_type="reference_to_video", img=img),
inputs=[description_input2, enhance_checkbox2, model_dropdown2, upscale_checkbox2, image_input2],
outputs=[output_textbox2, video_output2]
)
# Bot贸n "Extend" y su salida
extend_button2.click(
fn=lambda desc, enhance, model, upscale, img: run_commands(desc, "16:9", enhance, model, "general", upscale, task_type="extend", img=img, is_extend=True),
inputs=[description_input2, enhance_checkbox2, model_dropdown2, upscale_checkbox2, image_input2],
outputs=[output_textbox2, video_output2]
)
# Bot贸n "Re-create" y su salida
recreate_button2.click(
fn=lambda desc, enhance, model, upscale, img: run_commands(desc, "16:9", enhance, model, "general", upscale, task_type="reference_to_video", img=img, is_recreate=True),
inputs=[description_input2, enhance_checkbox2, model_dropdown2, upscale_checkbox2, image_input2],
outputs=[output_textbox2, video_output2]
)
# Bot贸n "Save" y su salida
save_button2.click(
fn=run_save_commands,
inputs=[],
outputs=[output_textbox2, video_output2]
)
# Tercera pesta帽a: Text to Video
with gr.Tab("Text to Video"):
with gr.Row():
with gr.Column():
description_input3 = gr.Textbox(label="Prompt",
placeholder="Enter text to begin creating a video",
elem_id="description_input3")
aspect_ratio_dropdown = gr.Dropdown(
choices=["16:9", "9:16", "4:3", "1:1"],
label="Aspect Ratio",
value="16:9",
elem_id="aspect_ratio_dropdown"
)
enhance_checkbox3 = gr.Checkbox(label="Enhance prompt", value=False, elem_id="enhance_checkbox3")
model_dropdown3 = gr.Dropdown(
choices=["vidu-1", "vidu-high-performance"],
label="Model",
value="vidu-1",
elem_id="model_dropdown3"
)
style_dropdown3 = gr.Dropdown(
choices=["general", "anime"],
label="Style",
value="general",
elem_id="style_dropdown3"
)
upscale_checkbox3 = gr.Checkbox(label="Upscale", value=False, elem_id="upscale_checkbox3")
create_button3 = gr.Button("Create", elem_id="create_button3")
extend_button3 = gr.Button("Extend", elem_id="extend_button3")
recreate_button3 = gr.Button("Re-create", elem_id="recreate_button3") # Nuevo bot贸n "Re-create"
save_button3 = gr.Button("Save", elem_id="save_button3") # Bot贸n de guardado
with gr.Column():
video_output3 = gr.Video(label="Video Output Text to Video", height=400, elem_id="video_output_text_to_video")
output_textbox3 = gr.Textbox(label="Output", interactive=False, elem_id="output_textbox3") # Cambia el nombre del textbox
# Bot贸n "Create" y su salida
create_button3.click(
fn=lambda desc, ratio, enhance, model, style, upscale: run_commands(desc, ratio, enhance, model, style,
upscale, task_type="text_to_video"),
inputs=[description_input3, aspect_ratio_dropdown, enhance_checkbox3, model_dropdown3, style_dropdown3,
upscale_checkbox3],
outputs=[output_textbox3, video_output3]
)
# Bot贸n "Extend" y su salida
extend_button3.click(
fn=lambda desc, enhance, model, upscale: run_commands(desc, "16:9", enhance, model, "general", upscale, task_type="extend", is_extend=True), # "general" como argumento
inputs=[description_input3, enhance_checkbox3, model_dropdown3, upscale_checkbox3], # Eliminado "general"
outputs=[output_textbox3, video_output3]
)
# Bot贸n "Re-create" y su salida
recreate_button3.click(
fn=lambda desc, ratio, enhance, model, style, upscale: run_commands(desc, ratio, enhance, model, style,
upscale, task_type="text_to_video", is_recreate=True),
inputs=[description_input3, aspect_ratio_dropdown, enhance_checkbox3, model_dropdown3, style_dropdown3,
upscale_checkbox3],
outputs=[output_textbox3, video_output3]
)
# Bot贸n "Save" y su salida
save_button3.click(
fn=run_save_commands,
inputs=[],
outputs=[output_textbox3, video_output3]
)
# Cuarta pesta帽a: Video to Video
with gr.Tab("Video to Video"):
with gr.Row():
with gr.Column():
video_input4 = gr.Video(label="Input Video", height=400, interactive=True) # Agregar entrada de video
description_input4 = gr.Textbox(label="Prompt",
placeholder="Enter text to begin creating a video",
elem_id="description_input4")
enhance_checkbox4 = gr.Checkbox(label="Enhance prompt", value=False, elem_id="enhance_checkbox4")
model_dropdown4 = gr.Dropdown(
choices=["vidu-1", "vidu-high-performance"],
label="Model",
value="vidu-1",
elem_id="model_dropdown4"
)
upscale_checkbox4 = gr.Checkbox(label="Upscale", value=False, elem_id="upscale_checkbox4")
create_button4 = gr.Button("Create", elem_id="create_button4")
extend_button4 = gr.Button("Extend", elem_id="extend_button4")
recreate_button4 = gr.Button("Re-create", elem_id="recreate_button4") # Nuevo bot贸n "Re-create"
save_button4 = gr.Button("Save", elem_id="save_button4") # Bot贸n de guardado
with gr.Column():
video_output4 = gr.Video(label="Video Output Video to Video", height=400, elem_id="video_output_video_to_video")
output_textbox4 = gr.Textbox(label="Output", interactive=False, elem_id="output_textbox4") # Cambia el nombre del textbox
# Guardar el video cargado en /content/Vidu_Studio/video.mp4
def save_uploaded_video(video):
if video is not None:
video_path = video
result = subprocess.run(f"cp '{video_path}' /content/Vidu_Studio/videotovideo.mp4", shell=True)
print(f"Video guardado en /content/Vidu_Studio/videotovideo.mp4")
print(result.stdout)
# Ejecutar save_uploaded_video cuando se carga un video
video_input4.upload(
fn=save_uploaded_video,
inputs=video_input4,
outputs=None
)
# Bot贸n "Create" y su salida
create_button4.click(
fn=lambda desc, enhance, model, upscale: run_commands(desc, "16:9", enhance, model, "general", upscale, task_type="video_to_video"), # "general" como argumento
inputs=[description_input4, enhance_checkbox4, model_dropdown4, upscale_checkbox4], # Eliminado "general"
outputs=[output_textbox4, video_output4]
)
# Bot贸n "Extend" y su salida
extend_button4.click(
fn=lambda desc, enhance, model, upscale: run_commands(desc, "16:9", enhance, model, "general", upscale, task_type="extend", is_extend=True), # "general" como argumento
inputs=[description_input4, enhance_checkbox4, model_dropdown4, upscale_checkbox4], # Eliminado "general"
outputs=[output_textbox4, video_output4]
)
# Bot贸n "Re-create" y su salida
recreate_button4.click(
fn=lambda desc, enhance, model, upscale: run_commands(desc, "16:9", enhance, model, "general", upscale, task_type="video_to_video", is_recreate=True), # "general" como argumento
inputs=[description_input4, enhance_checkbox4, model_dropdown4, upscale_checkbox4], # Eliminado "general"
outputs=[output_textbox4, video_output4]
)
# Bot贸n "Save" y su salida
save_button4.click(
fn=run_save_commands,
inputs=[],
outputs=[output_textbox4, video_output4]
)
# Ejecutar la interfaz
demo.launch(inline=False, debug=True, share=True) |