Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
from gradio_toggle import Toggle
|
| 3 |
import torch
|
| 4 |
from huggingface_hub import snapshot_download
|
|
|
|
| 5 |
|
| 6 |
from xora.models.autoencoders.causal_video_autoencoder import CausalVideoAutoencoder
|
| 7 |
from xora.models.transformers.transformer3d import Transformer3DModel
|
|
@@ -20,11 +21,33 @@ import tempfile
|
|
| 20 |
import os
|
| 21 |
import gc
|
| 22 |
from openai import OpenAI
|
|
|
|
| 23 |
|
| 24 |
# Load Hugging Face token if needed
|
| 25 |
hf_token = os.getenv("HF_TOKEN")
|
| 26 |
openai_api_key = os.getenv("OPENAI_API_KEY")
|
| 27 |
client = OpenAI(api_key=openai_api_key)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
system_prompt_t2v_path = "assets/system_prompt_t2v.txt"
|
| 29 |
system_prompt_i2v_path = "assets/system_prompt_i2v.txt"
|
| 30 |
with open(system_prompt_t2v_path, "r") as f:
|
|
@@ -47,7 +70,6 @@ scheduler_dir = Path(model_path) / "scheduler"
|
|
| 47 |
|
| 48 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 49 |
|
| 50 |
-
|
| 51 |
def load_vae(vae_dir):
|
| 52 |
vae_ckpt_path = vae_dir / "vae_diffusion_pytorch_model.safetensors"
|
| 53 |
vae_config_path = vae_dir / "config.json"
|
|
@@ -58,7 +80,6 @@ def load_vae(vae_dir):
|
|
| 58 |
vae.load_state_dict(vae_state_dict)
|
| 59 |
return vae.to(device=device, dtype=torch.bfloat16)
|
| 60 |
|
| 61 |
-
|
| 62 |
def load_unet(unet_dir):
|
| 63 |
unet_ckpt_path = unet_dir / "unet_diffusion_pytorch_model.safetensors"
|
| 64 |
unet_config_path = unet_dir / "config.json"
|
|
@@ -68,13 +89,11 @@ def load_unet(unet_dir):
|
|
| 68 |
transformer.load_state_dict(unet_state_dict, strict=True)
|
| 69 |
return transformer.to(device=device, dtype=torch.bfloat16)
|
| 70 |
|
| 71 |
-
|
| 72 |
def load_scheduler(scheduler_dir):
|
| 73 |
scheduler_config_path = scheduler_dir / "scheduler_config.json"
|
| 74 |
scheduler_config = RectifiedFlowScheduler.load_config(scheduler_config_path)
|
| 75 |
return RectifiedFlowScheduler.from_config(scheduler_config)
|
| 76 |
|
| 77 |
-
|
| 78 |
# Helper function for image processing
|
| 79 |
def center_crop_and_resize(frame, target_height, target_width):
|
| 80 |
h, w, _ = frame.shape
|
|
@@ -91,7 +110,6 @@ def center_crop_and_resize(frame, target_height, target_width):
|
|
| 91 |
frame_resized = cv2.resize(frame_cropped, (target_width, target_height))
|
| 92 |
return frame_resized
|
| 93 |
|
| 94 |
-
|
| 95 |
def load_image_to_tensor_with_resize(image_path, target_height=512, target_width=768):
|
| 96 |
image = Image.open(image_path).convert("RGB")
|
| 97 |
image_np = np.array(image)
|
|
@@ -100,7 +118,6 @@ def load_image_to_tensor_with_resize(image_path, target_height=512, target_width
|
|
| 100 |
frame_tensor = (frame_tensor / 127.5) - 1.0
|
| 101 |
return frame_tensor.unsqueeze(0).unsqueeze(2)
|
| 102 |
|
| 103 |
-
|
| 104 |
def enhance_prompt_if_enabled(prompt, enhance_toggle, type="t2v"):
|
| 105 |
if not enhance_toggle:
|
| 106 |
print("Enhance toggle is off, Prompt: ", prompt)
|
|
@@ -114,7 +131,7 @@ def enhance_prompt_if_enabled(prompt, enhance_toggle, type="t2v"):
|
|
| 114 |
|
| 115 |
try:
|
| 116 |
response = client.chat.completions.create(
|
| 117 |
-
model="gpt-
|
| 118 |
messages=messages,
|
| 119 |
max_tokens=200,
|
| 120 |
)
|
|
@@ -124,7 +141,6 @@ def enhance_prompt_if_enabled(prompt, enhance_toggle, type="t2v"):
|
|
| 124 |
print(f"Error: {e}")
|
| 125 |
return prompt
|
| 126 |
|
| 127 |
-
|
| 128 |
# Preset options for resolution and frame configuration
|
| 129 |
preset_options = [
|
| 130 |
{"label": "1216x704, 41 frames", "width": 1216, "height": 704, "num_frames": 41},
|
|
@@ -156,8 +172,6 @@ preset_options = [
|
|
| 156 |
{"label": "512x320, 257 frames", "width": 512, "height": 320, "num_frames": 257},
|
| 157 |
]
|
| 158 |
|
| 159 |
-
|
| 160 |
-
# Function to toggle visibility of sliders based on preset selection
|
| 161 |
def preset_changed(preset):
|
| 162 |
if preset != "Custom":
|
| 163 |
selected = next(item for item in preset_options if item["label"] == preset)
|
|
@@ -179,7 +193,6 @@ def preset_changed(preset):
|
|
| 179 |
gr.update(visible=True),
|
| 180 |
)
|
| 181 |
|
| 182 |
-
|
| 183 |
# Load models
|
| 184 |
vae = load_vae(vae_dir)
|
| 185 |
unet = load_unet(unet_dir)
|
|
@@ -201,7 +214,6 @@ pipeline = XoraVideoPipeline(
|
|
| 201 |
vae=vae,
|
| 202 |
).to(device)
|
| 203 |
|
| 204 |
-
|
| 205 |
def generate_video_from_text(
|
| 206 |
prompt="",
|
| 207 |
enhance_prompt_toggle=False,
|
|
@@ -217,11 +229,16 @@ def generate_video_from_text(
|
|
| 217 |
):
|
| 218 |
if len(prompt.strip()) < 50:
|
| 219 |
raise gr.Error(
|
| 220 |
-
"
|
| 221 |
duration=5,
|
| 222 |
)
|
| 223 |
|
| 224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
|
| 226 |
sample = {
|
| 227 |
"prompt": prompt,
|
|
@@ -257,7 +274,7 @@ def generate_video_from_text(
|
|
| 257 |
).images
|
| 258 |
except Exception as e:
|
| 259 |
raise gr.Error(
|
| 260 |
-
f"
|
| 261 |
duration=5,
|
| 262 |
)
|
| 263 |
finally:
|
|
@@ -275,13 +292,13 @@ def generate_video_from_text(
|
|
| 275 |
for frame in video_np[..., ::-1]:
|
| 276 |
out.write(frame)
|
| 277 |
out.release()
|
| 278 |
-
# Explicitly delete tensors and clear cache
|
| 279 |
del images
|
| 280 |
del video_np
|
| 281 |
torch.cuda.empty_cache()
|
| 282 |
return output_path
|
| 283 |
|
| 284 |
|
|
|
|
| 285 |
def generate_video_from_image(
|
| 286 |
image_path,
|
| 287 |
prompt="",
|
|
@@ -296,25 +313,29 @@ def generate_video_from_image(
|
|
| 296 |
num_frames=121,
|
| 297 |
progress=gr.Progress(),
|
| 298 |
):
|
| 299 |
-
|
| 300 |
print("Height: ", height)
|
| 301 |
print("Width: ", width)
|
| 302 |
print("Num Frames: ", num_frames)
|
| 303 |
|
| 304 |
if len(prompt.strip()) < 50:
|
| 305 |
raise gr.Error(
|
| 306 |
-
"
|
| 307 |
duration=5,
|
| 308 |
)
|
| 309 |
|
| 310 |
if not image_path:
|
| 311 |
-
raise gr.Error("
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
|
| 313 |
media_items = (
|
| 314 |
load_image_to_tensor_with_resize(image_path, height, width).to(device).detach()
|
| 315 |
)
|
| 316 |
|
| 317 |
-
|
|
|
|
| 318 |
|
| 319 |
sample = {
|
| 320 |
"prompt": prompt,
|
|
@@ -361,7 +382,7 @@ def generate_video_from_image(
|
|
| 361 |
out.release()
|
| 362 |
except Exception as e:
|
| 363 |
raise gr.Error(
|
| 364 |
-
f"
|
| 365 |
duration=5,
|
| 366 |
)
|
| 367 |
|
|
@@ -371,7 +392,6 @@ def generate_video_from_image(
|
|
| 371 |
|
| 372 |
return output_path
|
| 373 |
|
| 374 |
-
|
| 375 |
def create_advanced_options():
|
| 376 |
with gr.Accordion("Step 4: Advanced Options (Optional)", open=False):
|
| 377 |
seed = gr.Slider(
|
|
@@ -418,8 +438,7 @@ def create_advanced_options():
|
|
| 418 |
num_frames_slider,
|
| 419 |
]
|
| 420 |
|
| 421 |
-
|
| 422 |
-
# Define the Gradio interface with tabs
|
| 423 |
with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
| 424 |
with gr.Row(elem_id="title-row"):
|
| 425 |
gr.Markdown(
|
|
@@ -430,7 +449,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
|
| 430 |
"""
|
| 431 |
)
|
| 432 |
with gr.Row(elem_id="title-row"):
|
| 433 |
-
gr.HTML(
|
| 434 |
"""
|
| 435 |
<div style="display:flex;column-gap:4px;">
|
| 436 |
<a href="https://github.com/Lightricks/LTX-Video">
|
|
@@ -456,62 +475,63 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
|
| 456 |
):
|
| 457 |
gr.Markdown(
|
| 458 |
"""
|
| 459 |
-
๐
|
| 460 |
|
| 461 |
-
|
| 462 |
-
For best results, build your prompts using this structure:
|
| 463 |
|
| 464 |
-
|
| 465 |
-
- Add specific details about movements and gestures
|
| 466 |
-
- Describe character/object appearances precisely
|
| 467 |
-
- Include background and environment details
|
| 468 |
-
- Specify camera angles and movements
|
| 469 |
-
- Describe lighting and colors
|
| 470 |
-
- Note any changes or sudden events
|
| 471 |
|
| 472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
|
| 474 |
-
|
| 475 |
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
-
|
| 479 |
-
-
|
|
|
|
|
|
|
| 480 |
"""
|
| 481 |
)
|
| 482 |
|
| 483 |
with gr.Tabs():
|
| 484 |
# Text to Video Tab
|
| 485 |
-
with gr.TabItem("
|
| 486 |
with gr.Row():
|
| 487 |
with gr.Column():
|
| 488 |
txt2vid_prompt = gr.Textbox(
|
| 489 |
-
label="Step 1:
|
| 490 |
-
placeholder="
|
| 491 |
-
value="
|
| 492 |
lines=5,
|
| 493 |
)
|
| 494 |
txt2vid_enhance_toggle = Toggle(
|
| 495 |
-
label="
|
| 496 |
value=False,
|
| 497 |
interactive=True,
|
| 498 |
)
|
| 499 |
|
| 500 |
txt2vid_negative_prompt = gr.Textbox(
|
| 501 |
-
label="Step 2:
|
| 502 |
-
placeholder="
|
| 503 |
-
value="
|
| 504 |
lines=2,
|
| 505 |
)
|
| 506 |
|
| 507 |
txt2vid_preset = gr.Dropdown(
|
| 508 |
choices=[p["label"] for p in preset_options],
|
| 509 |
value="768x512, 97 frames",
|
| 510 |
-
label="Step 3.1:
|
| 511 |
)
|
| 512 |
|
| 513 |
txt2vid_frame_rate = gr.Slider(
|
| 514 |
-
label="Step 3.2:
|
| 515 |
minimum=21,
|
| 516 |
maximum=30,
|
| 517 |
step=1,
|
|
@@ -520,72 +540,72 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
|
| 520 |
|
| 521 |
txt2vid_advanced = create_advanced_options()
|
| 522 |
txt2vid_generate = gr.Button(
|
| 523 |
-
"Step 5:
|
| 524 |
variant="primary",
|
| 525 |
size="lg",
|
| 526 |
)
|
| 527 |
|
| 528 |
with gr.Column():
|
| 529 |
-
txt2vid_output = gr.Video(label="
|
| 530 |
|
| 531 |
with gr.Row():
|
| 532 |
gr.Examples(
|
| 533 |
examples=[
|
| 534 |
[
|
| 535 |
-
"
|
| 536 |
-
"
|
| 537 |
"assets/t2v_2.mp4",
|
| 538 |
],
|
| 539 |
[
|
| 540 |
-
"
|
| 541 |
-
"
|
| 542 |
"assets/t2v_1.mp4",
|
| 543 |
],
|
| 544 |
[
|
| 545 |
-
"
|
| 546 |
-
"
|
| 547 |
"assets/t2v_0.mp4",
|
| 548 |
],
|
| 549 |
],
|
| 550 |
inputs=[txt2vid_prompt, txt2vid_negative_prompt, txt2vid_output],
|
| 551 |
-
label="
|
| 552 |
)
|
| 553 |
|
| 554 |
# Image to Video Tab
|
| 555 |
-
with gr.TabItem("
|
| 556 |
with gr.Row():
|
| 557 |
with gr.Column():
|
| 558 |
img2vid_image = gr.Image(
|
| 559 |
type="filepath",
|
| 560 |
-
label="Step 1:
|
| 561 |
elem_id="image_upload",
|
| 562 |
)
|
| 563 |
img2vid_prompt = gr.Textbox(
|
| 564 |
-
label="Step 2:
|
| 565 |
-
placeholder="
|
| 566 |
-
value="
|
| 567 |
lines=5,
|
| 568 |
)
|
| 569 |
img2vid_enhance_toggle = Toggle(
|
| 570 |
-
label="
|
| 571 |
value=False,
|
| 572 |
interactive=True,
|
| 573 |
)
|
| 574 |
img2vid_negative_prompt = gr.Textbox(
|
| 575 |
-
label="Step 3:
|
| 576 |
-
placeholder="
|
| 577 |
-
value="
|
| 578 |
lines=2,
|
| 579 |
)
|
| 580 |
|
| 581 |
img2vid_preset = gr.Dropdown(
|
| 582 |
choices=[p["label"] for p in preset_options],
|
| 583 |
value="768x512, 97 frames",
|
| 584 |
-
label="Step 3.1:
|
| 585 |
)
|
| 586 |
|
| 587 |
img2vid_frame_rate = gr.Slider(
|
| 588 |
-
label="Step 3.2:
|
| 589 |
minimum=21,
|
| 590 |
maximum=30,
|
| 591 |
step=1,
|
|
@@ -594,31 +614,31 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
|
| 594 |
|
| 595 |
img2vid_advanced = create_advanced_options()
|
| 596 |
img2vid_generate = gr.Button(
|
| 597 |
-
"Step 6:
|
| 598 |
)
|
| 599 |
|
| 600 |
with gr.Column():
|
| 601 |
-
img2vid_output = gr.Video(label="
|
| 602 |
|
| 603 |
with gr.Row():
|
| 604 |
gr.Examples(
|
| 605 |
examples=[
|
| 606 |
[
|
| 607 |
"assets/i2v_i2.png",
|
| 608 |
-
"
|
| 609 |
-
"
|
| 610 |
"assets/i2v_2.mp4",
|
| 611 |
],
|
| 612 |
[
|
| 613 |
"assets/i2v_i0.png",
|
| 614 |
-
"
|
| 615 |
-
"
|
| 616 |
"assets/i2v_0.mp4",
|
| 617 |
],
|
| 618 |
[
|
| 619 |
"assets/i2v_i1.png",
|
| 620 |
-
"
|
| 621 |
-
"
|
| 622 |
"assets/i2v_1.mp4",
|
| 623 |
],
|
| 624 |
],
|
|
@@ -628,10 +648,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
|
| 628 |
img2vid_negative_prompt,
|
| 629 |
img2vid_output,
|
| 630 |
],
|
| 631 |
-
label="
|
| 632 |
)
|
| 633 |
|
| 634 |
-
#
|
| 635 |
txt2vid_preset.change(
|
| 636 |
fn=preset_changed, inputs=[txt2vid_preset], outputs=txt2vid_advanced[3:]
|
| 637 |
)
|
|
@@ -674,4 +694,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
|
| 674 |
if __name__ == "__main__":
|
| 675 |
iface.queue(max_size=64, default_concurrency_limit=1, api_open=False).launch(
|
| 676 |
share=True, show_api=False
|
| 677 |
-
)
|
|
|
|
| 2 |
from gradio_toggle import Toggle
|
| 3 |
import torch
|
| 4 |
from huggingface_hub import snapshot_download
|
| 5 |
+
from transformers import pipeline
|
| 6 |
|
| 7 |
from xora.models.autoencoders.causal_video_autoencoder import CausalVideoAutoencoder
|
| 8 |
from xora.models.transformers.transformer3d import Transformer3DModel
|
|
|
|
| 21 |
import os
|
| 22 |
import gc
|
| 23 |
from openai import OpenAI
|
| 24 |
+
import re
|
| 25 |
|
| 26 |
# Load Hugging Face token if needed
|
| 27 |
hf_token = os.getenv("HF_TOKEN")
|
| 28 |
openai_api_key = os.getenv("OPENAI_API_KEY")
|
| 29 |
client = OpenAI(api_key=openai_api_key)
|
| 30 |
+
|
| 31 |
+
# Initialize translation pipeline
|
| 32 |
+
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-ko-en")
|
| 33 |
+
|
| 34 |
+
# Korean text detection function
|
| 35 |
+
def contains_korean(text):
|
| 36 |
+
korean_pattern = re.compile('[ใฑ-ใ
ใ
-ใ
ฃ๊ฐ-ํฃ]')
|
| 37 |
+
return bool(korean_pattern.search(text))
|
| 38 |
+
|
| 39 |
+
def translate_korean_prompt(prompt):
|
| 40 |
+
"""
|
| 41 |
+
Translate Korean prompt to English if Korean text is detected
|
| 42 |
+
"""
|
| 43 |
+
if contains_korean(prompt):
|
| 44 |
+
translated = translator(prompt)[0]['translation_text']
|
| 45 |
+
print(f"Original Korean prompt: {prompt}")
|
| 46 |
+
print(f"Translated English prompt: {translated}")
|
| 47 |
+
return translated
|
| 48 |
+
return prompt
|
| 49 |
+
|
| 50 |
+
# Load system prompts
|
| 51 |
system_prompt_t2v_path = "assets/system_prompt_t2v.txt"
|
| 52 |
system_prompt_i2v_path = "assets/system_prompt_i2v.txt"
|
| 53 |
with open(system_prompt_t2v_path, "r") as f:
|
|
|
|
| 70 |
|
| 71 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 72 |
|
|
|
|
| 73 |
def load_vae(vae_dir):
|
| 74 |
vae_ckpt_path = vae_dir / "vae_diffusion_pytorch_model.safetensors"
|
| 75 |
vae_config_path = vae_dir / "config.json"
|
|
|
|
| 80 |
vae.load_state_dict(vae_state_dict)
|
| 81 |
return vae.to(device=device, dtype=torch.bfloat16)
|
| 82 |
|
|
|
|
| 83 |
def load_unet(unet_dir):
|
| 84 |
unet_ckpt_path = unet_dir / "unet_diffusion_pytorch_model.safetensors"
|
| 85 |
unet_config_path = unet_dir / "config.json"
|
|
|
|
| 89 |
transformer.load_state_dict(unet_state_dict, strict=True)
|
| 90 |
return transformer.to(device=device, dtype=torch.bfloat16)
|
| 91 |
|
|
|
|
| 92 |
def load_scheduler(scheduler_dir):
|
| 93 |
scheduler_config_path = scheduler_dir / "scheduler_config.json"
|
| 94 |
scheduler_config = RectifiedFlowScheduler.load_config(scheduler_config_path)
|
| 95 |
return RectifiedFlowScheduler.from_config(scheduler_config)
|
| 96 |
|
|
|
|
| 97 |
# Helper function for image processing
|
| 98 |
def center_crop_and_resize(frame, target_height, target_width):
|
| 99 |
h, w, _ = frame.shape
|
|
|
|
| 110 |
frame_resized = cv2.resize(frame_cropped, (target_width, target_height))
|
| 111 |
return frame_resized
|
| 112 |
|
|
|
|
| 113 |
def load_image_to_tensor_with_resize(image_path, target_height=512, target_width=768):
|
| 114 |
image = Image.open(image_path).convert("RGB")
|
| 115 |
image_np = np.array(image)
|
|
|
|
| 118 |
frame_tensor = (frame_tensor / 127.5) - 1.0
|
| 119 |
return frame_tensor.unsqueeze(0).unsqueeze(2)
|
| 120 |
|
|
|
|
| 121 |
def enhance_prompt_if_enabled(prompt, enhance_toggle, type="t2v"):
|
| 122 |
if not enhance_toggle:
|
| 123 |
print("Enhance toggle is off, Prompt: ", prompt)
|
|
|
|
| 131 |
|
| 132 |
try:
|
| 133 |
response = client.chat.completions.create(
|
| 134 |
+
model="gpt-4-1106-preview",
|
| 135 |
messages=messages,
|
| 136 |
max_tokens=200,
|
| 137 |
)
|
|
|
|
| 141 |
print(f"Error: {e}")
|
| 142 |
return prompt
|
| 143 |
|
|
|
|
| 144 |
# Preset options for resolution and frame configuration
|
| 145 |
preset_options = [
|
| 146 |
{"label": "1216x704, 41 frames", "width": 1216, "height": 704, "num_frames": 41},
|
|
|
|
| 172 |
{"label": "512x320, 257 frames", "width": 512, "height": 320, "num_frames": 257},
|
| 173 |
]
|
| 174 |
|
|
|
|
|
|
|
| 175 |
def preset_changed(preset):
|
| 176 |
if preset != "Custom":
|
| 177 |
selected = next(item for item in preset_options if item["label"] == preset)
|
|
|
|
| 193 |
gr.update(visible=True),
|
| 194 |
)
|
| 195 |
|
|
|
|
| 196 |
# Load models
|
| 197 |
vae = load_vae(vae_dir)
|
| 198 |
unet = load_unet(unet_dir)
|
|
|
|
| 214 |
vae=vae,
|
| 215 |
).to(device)
|
| 216 |
|
|
|
|
| 217 |
def generate_video_from_text(
|
| 218 |
prompt="",
|
| 219 |
enhance_prompt_toggle=False,
|
|
|
|
| 229 |
):
|
| 230 |
if len(prompt.strip()) < 50:
|
| 231 |
raise gr.Error(
|
| 232 |
+
"ํ๋กฌํํธ๋ ์ต์ 50์ ์ด์์ด์ด์ผ ํฉ๋๋ค. ๋ ์์ธํ ์ค๋ช
์ ์ ๊ณตํด์ฃผ์ธ์.",
|
| 233 |
duration=5,
|
| 234 |
)
|
| 235 |
|
| 236 |
+
# Translate Korean prompts to English
|
| 237 |
+
prompt = translate_korean_prompt(prompt)
|
| 238 |
+
negative_prompt = translate_korean_prompt(negative_prompt)
|
| 239 |
+
|
| 240 |
+
if enhance_prompt_toggle:
|
| 241 |
+
prompt = enhance_prompt_if_enabled(prompt, enhance_prompt_toggle, type="t2v")
|
| 242 |
|
| 243 |
sample = {
|
| 244 |
"prompt": prompt,
|
|
|
|
| 274 |
).images
|
| 275 |
except Exception as e:
|
| 276 |
raise gr.Error(
|
| 277 |
+
f"๋น๋์ค ์์ฑ ์ค ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. ๋ค์ ์๋ํด์ฃผ์ธ์. ์ค๋ฅ: {e}",
|
| 278 |
duration=5,
|
| 279 |
)
|
| 280 |
finally:
|
|
|
|
| 292 |
for frame in video_np[..., ::-1]:
|
| 293 |
out.write(frame)
|
| 294 |
out.release()
|
|
|
|
| 295 |
del images
|
| 296 |
del video_np
|
| 297 |
torch.cuda.empty_cache()
|
| 298 |
return output_path
|
| 299 |
|
| 300 |
|
| 301 |
+
|
| 302 |
def generate_video_from_image(
|
| 303 |
image_path,
|
| 304 |
prompt="",
|
|
|
|
| 313 |
num_frames=121,
|
| 314 |
progress=gr.Progress(),
|
| 315 |
):
|
|
|
|
| 316 |
print("Height: ", height)
|
| 317 |
print("Width: ", width)
|
| 318 |
print("Num Frames: ", num_frames)
|
| 319 |
|
| 320 |
if len(prompt.strip()) < 50:
|
| 321 |
raise gr.Error(
|
| 322 |
+
"ํ๋กฌํํธ๋ ์ต์ 50์ ์ด์์ด์ด์ผ ํฉ๋๋ค. ๋ ์์ธํ ์ค๋ช
์ ์ ๊ณตํด์ฃผ์ธ์.",
|
| 323 |
duration=5,
|
| 324 |
)
|
| 325 |
|
| 326 |
if not image_path:
|
| 327 |
+
raise gr.Error("์
๋ ฅ ์ด๋ฏธ์ง๋ฅผ ์ ๊ณตํด์ฃผ์ธ์.", duration=5)
|
| 328 |
+
|
| 329 |
+
# Translate Korean prompts to English
|
| 330 |
+
prompt = translate_korean_prompt(prompt)
|
| 331 |
+
negative_prompt = translate_korean_prompt(negative_prompt)
|
| 332 |
|
| 333 |
media_items = (
|
| 334 |
load_image_to_tensor_with_resize(image_path, height, width).to(device).detach()
|
| 335 |
)
|
| 336 |
|
| 337 |
+
if enhance_prompt_toggle:
|
| 338 |
+
prompt = enhance_prompt_if_enabled(prompt, enhance_prompt_toggle, type="i2v")
|
| 339 |
|
| 340 |
sample = {
|
| 341 |
"prompt": prompt,
|
|
|
|
| 382 |
out.release()
|
| 383 |
except Exception as e:
|
| 384 |
raise gr.Error(
|
| 385 |
+
f"๋น๋์ค ์์ฑ ์ค ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. ๋ค์ ์๋ํด์ฃผ์ธ์. ์ค๋ฅ: {e}",
|
| 386 |
duration=5,
|
| 387 |
)
|
| 388 |
|
|
|
|
| 392 |
|
| 393 |
return output_path
|
| 394 |
|
|
|
|
| 395 |
def create_advanced_options():
|
| 396 |
with gr.Accordion("Step 4: Advanced Options (Optional)", open=False):
|
| 397 |
seed = gr.Slider(
|
|
|
|
| 438 |
num_frames_slider,
|
| 439 |
]
|
| 440 |
|
| 441 |
+
# Gradio Interface Definition
|
|
|
|
| 442 |
with gr.Blocks(theme=gr.themes.Soft()) as iface:
|
| 443 |
with gr.Row(elem_id="title-row"):
|
| 444 |
gr.Markdown(
|
|
|
|
| 449 |
"""
|
| 450 |
)
|
| 451 |
with gr.Row(elem_id="title-row"):
|
| 452 |
+
gr.HTML(
|
| 453 |
"""
|
| 454 |
<div style="display:flex;column-gap:4px;">
|
| 455 |
<a href="https://github.com/Lightricks/LTX-Video">
|
|
|
|
| 475 |
):
|
| 476 |
gr.Markdown(
|
| 477 |
"""
|
| 478 |
+
๐ ํ๋กฌํํธ ์์ฑ ํ
|
| 479 |
|
| 480 |
+
ํ๋กฌํํธ ์์ฑ ์ ๋์๊ณผ ์ฅ๋ฉด์ ๋ํ ์์ธํ๊ณ ์๊ฐ ์์๋๋ก ๋ ์ค๋ช
์ ์ง์คํ์ธ์. ๊ตฌ์ฒด์ ์ธ ์์ง์, ์ธ๋ชจ, ์นด๋ฉ๋ผ ๊ฐ๋, ํ๊ฒฝ ์ธ๋ถ ์ฌํญ์ ํฌํจํ๋ ํ๋์ ๋ฌธ๋จ์ผ๋ก ์์ฐ์ค๋ฝ๊ฒ ์์ฑํ์ธ์. ๋์์ผ๋ก ๋ฐ๋ก ์์ํ๊ณ , ์ค๋ช
์ ๋ฌธ์ ๊ทธ๋๋ก ์ ํํ๊ฒ ํด์ฃผ์ธ์. ์ดฌ์ ๊ฐ๋
์ด ์ดฌ์ ๋ชฉ๋ก์ ์ค๋ช
ํ๋ ๊ฒ์ฒ๋ผ ์๊ฐํ์ธ์. 200๋จ์ด ์ด๋ด๋ก ์์ฑํ์ธ์.
|
|
|
|
| 481 |
|
| 482 |
+
ํ๋กฌํํธ๋ ๋ค์ ๊ตฌ์กฐ๋ก ์์ฑํ๋ฉด ์ข์ต๋๋ค:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 483 |
|
| 484 |
+
- ์ฃผ์ ๋์์ ํ ๋ฌธ์ฅ์ผ๋ก ์์
|
| 485 |
+
- ๊ตฌ์ฒด์ ์ธ ๋์๊ณผ ์ ์ค์ฒ ์ถ๊ฐ
|
| 486 |
+
- ์บ๋ฆญํฐ/๊ฐ์ฒด์ ์ธ๋ชจ๋ฅผ ์ ํํ ์ค๋ช
|
| 487 |
+
- ๏ฟฝ๏ฟฝ๊ฒฝ๊ณผ ํ๊ฒฝ ์ธ๋ถ ์ฌํญ ํฌํจ
|
| 488 |
+
- ์นด๋ฉ๋ผ ๊ฐ๋์ ์์ง์ ์ง์
|
| 489 |
+
- ์กฐ๋ช
๊ณผ ์์ ์ค๋ช
|
| 490 |
+
- ๋ณํ๋ ๊ฐ์์ค๋ฌ์ด ์ฌ๊ฑด ๊ธฐ๋ก
|
| 491 |
|
| 492 |
+
์์๋ฅผ ์ฐธ๊ณ ํ์ธ์.
|
| 493 |
|
| 494 |
+
๐ฎ ๋งค๊ฐ๋ณ์ ๊ฐ์ด๋
|
| 495 |
+
|
| 496 |
+
- ํด์๋ ํ๋ฆฌ์
: ์์ธํ ์ฅ๋ฉด์ ๋์ ํด์๋, ๋จ์ํ ์ฅ๋ฉด์ ๋ฎ์ ํด์๋ ์ ํ
|
| 497 |
+
- Seed: ํน์ ์คํ์ผ์ด๋ ๊ตฌ์ฑ์ ์ฌํํ๊ณ ์ถ์ ๋ seed ๊ฐ ์ ์ฅ
|
| 498 |
+
- Guidance Scale: 3-3.5๊ฐ ๊ถ์ฅ๊ฐ
|
| 499 |
+
- Inference Steps: ํ์ง์ ์ํด์๋ 40+ ๋จ๊ณ, ์๋๋ฅผ ์ํด์๋ 20-30 ๋จ๊ณ
|
| 500 |
"""
|
| 501 |
)
|
| 502 |
|
| 503 |
with gr.Tabs():
|
| 504 |
# Text to Video Tab
|
| 505 |
+
with gr.TabItem("ํ
์คํธ๋ก ๋น๋์ค ๋ง๋ค๊ธฐ"):
|
| 506 |
with gr.Row():
|
| 507 |
with gr.Column():
|
| 508 |
txt2vid_prompt = gr.Textbox(
|
| 509 |
+
label="Step 1: ํ๋กฌํํธ ์
๋ ฅ",
|
| 510 |
+
placeholder="์์ฑํ๊ณ ์ถ์ ๋น๋์ค๋ฅผ ์ค๋ช
ํ์ธ์ (์ต์ 50์)...",
|
| 511 |
+
value="๊ฐ์ ๊ธด ๋จธ๋ฆฌ๋ฅผ ๊ฐ์ง ์ฌ์ฑ์ด ๊ธ๋ฐ์ ๊ธด ๋จธ๋ฆฌ๋ฅผ ๊ฐ์ง ๋ค๋ฅธ ์ฌ์ฑ์ ํฅํด ๋ฏธ์์ง์ต๋๋ค. ๊ฐ์ ๋จธ๋ฆฌ์ ์ฌ์ฑ์ ๊ฒ์์ ์์ผ์ ์
๊ณ ์์ผ๋ฉฐ ์ค๋ฅธ์ชฝ ๋บจ์ ์์ ์ ์ด ์์ต๋๋ค. ์นด๋ฉ๋ผ ๊ฐ๋๋ ๊ฐ์ ๋จธ๋ฆฌ ์ฌ์ฑ์ ์ผ๊ตด์ ํด๋ก์ฆ์
๋์ด ์์ต๋๋ค. ์กฐ๋ช
์ ์์ฐ์ค๋ฝ๊ณ ๋ฐ๋ปํ๋ฉฐ, ์์์์ ์ค๋ ๋ฏํ ๋ถ๋๋ฌ์ด ๋น์ด ์ฅ๋ฉด์ ๋น์ถฅ๋๋ค. ์ฅ๋ฉด์ ์ค์ ์์์ฒ๋ผ ๋ณด์
๋๋ค.",
|
| 512 |
lines=5,
|
| 513 |
)
|
| 514 |
txt2vid_enhance_toggle = Toggle(
|
| 515 |
+
label="ํ๋กฌํํธ ๊ฐ์ ",
|
| 516 |
value=False,
|
| 517 |
interactive=True,
|
| 518 |
)
|
| 519 |
|
| 520 |
txt2vid_negative_prompt = gr.Textbox(
|
| 521 |
+
label="Step 2: ๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ ์
๋ ฅ",
|
| 522 |
+
placeholder="๋น๋์ค์์ ์ํ์ง ์๋ ์์๋ฅผ ์ค๋ช
ํ์ธ์...",
|
| 523 |
+
value="๋ฎ์ ํ์ง, ์ต์
์ ํ์ง, ๊ธฐํ, ์๊ณก๋, ์ผ๊ทธ๋ฌ์ง, ๋ชจ์
์ค๋ฏธ์ด, ๋ชจ์
์ํฐํฉํธ, ์ตํฉ๋ ์๊ฐ๋ฝ, ์๋ชป๋ ํด๋ถํ, ์ด์ํ ์, ์ถํ",
|
| 524 |
lines=2,
|
| 525 |
)
|
| 526 |
|
| 527 |
txt2vid_preset = gr.Dropdown(
|
| 528 |
choices=[p["label"] for p in preset_options],
|
| 529 |
value="768x512, 97 frames",
|
| 530 |
+
label="Step 3.1: ํด์๋ ํ๋ฆฌ์
์ ํ",
|
| 531 |
)
|
| 532 |
|
| 533 |
txt2vid_frame_rate = gr.Slider(
|
| 534 |
+
label="Step 3.2: ํ๋ ์ ๋ ์ดํธ",
|
| 535 |
minimum=21,
|
| 536 |
maximum=30,
|
| 537 |
step=1,
|
|
|
|
| 540 |
|
| 541 |
txt2vid_advanced = create_advanced_options()
|
| 542 |
txt2vid_generate = gr.Button(
|
| 543 |
+
"Step 5: ๋น๋์ค ์์ฑ",
|
| 544 |
variant="primary",
|
| 545 |
size="lg",
|
| 546 |
)
|
| 547 |
|
| 548 |
with gr.Column():
|
| 549 |
+
txt2vid_output = gr.Video(label="์์ฑ๋ ๋น๋์ค")
|
| 550 |
|
| 551 |
with gr.Row():
|
| 552 |
gr.Examples(
|
| 553 |
examples=[
|
| 554 |
[
|
| 555 |
+
"์ ํต์ ์ธ ๋ชฝ๊ณจ ๋๋ ์ค๋ฅผ ์
์ ์ ์ ์ฌ์ฑ์ด ์์ ํฐ์ ์ปคํผ์ ํตํด ํธ๊ธฐ์ฌ๊ณผ ๊ธด์ฅ์ด ์์ธ ํ์ ์ผ๋ก ๋ค์ฌ๋ค๋ณด๊ณ ์์ต๋๋ค. ์ฌ์ฑ์ ํฐ ๊ตฌ์ฌ๋ก ์ฅ์๋ ๋ ๊ฐ์ ๋์ ๋จธ๋ฆฌ๋ก ์คํ์ผ๋ง๋ ๊ธด ๊ฒ์ ๋จธ๋ฆฌ๋ฅผ ํ๊ณ ์์ผ๋ฉฐ, ๋์ ๋๋์ ๋๋ฉฐ ํฌ๊ฒ ๋ ์ ธ ์์ต๋๋ค. ๊ทธ๋
์ ๋๋ ์ค๋ ํ๋ คํ ๊ธ์ ์์๊ฐ ์๊ฒจ์ง ์ ๋ช
ํ ํ๋์์ด๋ฉฐ, ๋น์ทํ ๋์์ธ์ ๋จธ๋ฆฌ๋ ๋ฅผ ํ๊ณ ์์ต๋๋ค. ๋ฐฐ๊ฒฝ์ ์ ๋น๋ก์๊ณผ ํธ๊ธฐ์ฌ์ ์์๋ด๋ ๋จ์ํ ํฐ์ ์ปคํผ์
๋๋ค.",
|
| 556 |
+
"๋ฎ์ ํ์ง, ์ต์
์ ํ์ง, ๊ธฐํ, ์๊ณก๋, ์ผ๊ทธ๋ฌ์ง, ๋ชจ์
์ค๋ฏธ์ด, ๋ชจ์
์ํฐํฉํธ, ์ตํฉ๋ ์๊ฐ๋ฝ, ์๋ชป๋ ํด๋ถํ, ์ด์ํ ์, ์ถํ",
|
| 557 |
"assets/t2v_2.mp4",
|
| 558 |
],
|
| 559 |
[
|
| 560 |
+
"๋
ธ๋์ ์ฌํท์ ์
์ ๊ธ๋ฐ ๋จธ๋ฆฌ์ ์ ์ ๋จ์๊ฐ ์ฒ์ ์์ ์ฃผ์๋ฅผ ๋๋ฌ๋ด
๋๋ค. ๊ทธ๋ ๋ฐ์ ํผ๋ถ๋ฅผ ๊ฐ์ก๊ณ ๋จธ๋ฆฌ๋ ๊ฐ์ด๋ฐ ๊ฐ๋ฅด๋ง๋ก ์คํ์ผ๋ง๋์ด ์์ต๋๋ค. ๊ทธ๋ ์ผ์ชฝ์ ๋ณด๊ณ ๋ ํ ์ค๋ฅธ์ชฝ์ ๋ณด๋ฉฐ, ๊ฐ ๋ฐฉํฅ์ ์ ์ ์์ํฉ๋๋ค. ์นด๋ฉ๋ผ๋ ๋ฎ์ ๊ฐ๋์์ ๋จ์๋ฅผ ์ฌ๋ ค๋ค๋ณด๋ฉฐ ๊ณ ์ ๋์ด ์์ต๋๋ค. ๋ฐฐ๊ฒฝ์ ์ฝ๊ฐ ํ๋ฆฟํ๋ฉฐ, ๋
น์ ๋๋ฌด๋ค๊ณผ ๋จ์์ ๋ค์์ ๋ฐ๊ฒ ๋น์น๋ ํ์์ด ๋ณด์
๋๋ค. ์กฐ๋ช
์ ์์ฐ์ค๋ฝ๊ณ ๋ฐ๋ปํ๋ฉฐ, ํ์ ๋น์ด ๋จ์์ ์ผ๊ตด์ ๊ฐ๋ก์ง๋ฅด๋ ๋ ์ฆ ํ๋ ์ด๋ฅผ ๋ง๋ญ๋๋ค. ์ฅ๋ฉด์ ์ค์ ์์์ฒ๋ผ ์ดฌ์๋์์ต๋๋ค.",
|
| 561 |
+
"๋ฎ์ ํ์ง, ์ต์
์ ํ์ง, ๊ธฐํ, ์๊ณก๋, ์ผ๊ทธ๋ฌ์ง, ๋ชจ์
์ค๋ฏธ์ด, ๋ชจ์
์ํฐํฉํธ, ์ตํฉ๋ ์๊ฐ๋ฝ, ์๋ชป๋ ํด๋ถํ, ์ด์ํ ์, ์ถํ",
|
| 562 |
"assets/t2v_1.mp4",
|
| 563 |
],
|
| 564 |
[
|
| 565 |
+
"ํ ์ฌ์ดํด๋ฆฌ์คํธ๊ฐ ๊ตฝ์ด์ง ์ฐ๊ธธ์ ๋ฐ๋ผ ๋ฌ๋ฆฝ๋๋ค. ๊ณต๊ธฐ์ญํ์ ์ธ ์ฅ๋น๋ฅผ ์
์ ๊ทธ๋ ๊ฐํ๊ฒ ํ๋ฌ์ ๋ฐ๊ณ ์์ผ๋ฉฐ, ์ด๋ง์๋ ๋๋ฐฉ์ธ์ด ๋ฐ์ง์
๋๋ค. ์นด๋ฉ๋ผ๋ ๊ทธ์ ๊ฒฐ์ฐํ ํ์ ๊ณผ ์จ ๋งํ๋ ํ๊ฒฝ์ ๋ฒ๊ฐ์๊ฐ๋ฉฐ ๋ณด์ฌ์ค๋๋ค. ์๋๋ฌด๋ค์ด ์ค์ณ ์ง๋๊ฐ๊ณ , ํ๋์ ์ ๋ช
ํ ํ๋์์
๋๋ค. ์ด ์ฅ๋ฉด์ ํ๊ธฐ์ฐจ๊ณ ๊ฒฝ์์ ์ธ ๋ถ์๊ธฐ๋ฅผ ์์๋
๋๋ค.",
|
| 566 |
+
"๋ฎ์ ํ์ง, ์ต์
์ ํ์ง, ๊ธฐํ, ์๊ณก๋, ์ผ๊ทธ๋ฌ์ง, ๋ชจ์
์ค๋ฏธ์ด, ๋ชจ์
์ํฐํฉํธ, ์ตํฉ๋ ์๊ฐ๋ฝ, ์๋ชป๋ ํด๋ถํ, ์ด์ํ ์, ์ถํ",
|
| 567 |
"assets/t2v_0.mp4",
|
| 568 |
],
|
| 569 |
],
|
| 570 |
inputs=[txt2vid_prompt, txt2vid_negative_prompt, txt2vid_output],
|
| 571 |
+
label="ํ
์คํธ-๋น๋์ค ์์ฑ ์์",
|
| 572 |
)
|
| 573 |
|
| 574 |
# Image to Video Tab
|
| 575 |
+
with gr.TabItem("์ด๋ฏธ์ง๋ก ๋น๋์ค ๋ง๋ค๊ธฐ"):
|
| 576 |
with gr.Row():
|
| 577 |
with gr.Column():
|
| 578 |
img2vid_image = gr.Image(
|
| 579 |
type="filepath",
|
| 580 |
+
label="Step 1: ์
๋ ฅ ์ด๋ฏธ์ง ์
๋ก๋",
|
| 581 |
elem_id="image_upload",
|
| 582 |
)
|
| 583 |
img2vid_prompt = gr.Textbox(
|
| 584 |
+
label="Step 2: ํ๋กฌํํธ ์
๋ ฅ",
|
| 585 |
+
placeholder="์ด๋ฏธ์ง๋ฅผ ์ด๋ป๊ฒ ์ ๋๋ฉ์ด์
ํํ ์ง ์ค๋ช
ํ์ธ์ (์ต์ 50์)...",
|
| 586 |
+
value="๊ฐ์ ๊ธด ๋จธ๋ฆฌ๋ฅผ ๊ฐ์ง ์ฌ์ฑ์ด ๊ธ๋ฐ์ ๊ธด ๋จธ๋ฆฌ๋ฅผ ๊ฐ์ง ๋ค๋ฅธ ์ฌ์ฑ์ ํฅํด ๋ฏธ์์ง์ต๋๋ค. ๊ฐ์ ๋จธ๋ฆฌ์ ์ฌ์ฑ์ ๊ฒ์์ ์์ผ์ ์
๊ณ ์์ผ๋ฉฐ ์ค๋ฅธ์ชฝ ๋บจ์ ์์ ์ ์ด ์์ต๋๋ค. ์นด๋ฉ๋ผ ๊ฐ๋๋ ๊ฐ์ ๋จธ๋ฆฌ ์ฌ์ฑ์ ์ผ๊ตด์ ํด๋ก์ฆ์
๋์ด ์์ต๋๋ค. ์กฐ๋ช
์ ์์ฐ์ค๋ฝ๊ณ ๋ฐ๋ปํ๋ฉฐ, ์์์์ ์ค๋ ๋ฏํ ๋ถ๋๋ฌ์ด ๋น์ด ์ฅ๋ฉด์ ๋น์ถฅ๋๋ค. ์ฅ๋ฉด์ ์ค์ ์์์ฒ๋ผ ๋ณด์
๋๋ค.",
|
| 587 |
lines=5,
|
| 588 |
)
|
| 589 |
img2vid_enhance_toggle = Toggle(
|
| 590 |
+
label="ํ๋กฌํํธ ๊ฐ์ ",
|
| 591 |
value=False,
|
| 592 |
interactive=True,
|
| 593 |
)
|
| 594 |
img2vid_negative_prompt = gr.Textbox(
|
| 595 |
+
label="Step 3: ๋ค๊ฑฐํฐ๋ธ ํ๋กฌํํธ ์
๋ ฅ",
|
| 596 |
+
placeholder="๋น๋์ค์์ ์ํ์ง ์๋ ์์๋ฅผ ์ค๋ช
ํ์ธ์...",
|
| 597 |
+
value="๋ฎ์ ํ์ง, ์ต์
์ ํ์ง, ๊ธฐํ, ์๊ณก๋, ์ผ๊ทธ๋ฌ์ง, ๋ชจ์
์ค๋ฏธ์ด, ๋ชจ์
์ํฐํฉํธ, ์ตํฉ๋ ์๊ฐ๋ฝ, ์๋ชป๋ ํด๋ถํ, ์ด์ํ ์, ์ถํ",
|
| 598 |
lines=2,
|
| 599 |
)
|
| 600 |
|
| 601 |
img2vid_preset = gr.Dropdown(
|
| 602 |
choices=[p["label"] for p in preset_options],
|
| 603 |
value="768x512, 97 frames",
|
| 604 |
+
label="Step 3.1: ํด์๋ ํ๋ฆฌ์
์ ํ",
|
| 605 |
)
|
| 606 |
|
| 607 |
img2vid_frame_rate = gr.Slider(
|
| 608 |
+
label="Step 3.2: ํ๋ ์ ๋ ์ดํธ",
|
| 609 |
minimum=21,
|
| 610 |
maximum=30,
|
| 611 |
step=1,
|
|
|
|
| 614 |
|
| 615 |
img2vid_advanced = create_advanced_options()
|
| 616 |
img2vid_generate = gr.Button(
|
| 617 |
+
"Step 6: ๋น๋์ค ์์ฑ", variant="primary", size="lg"
|
| 618 |
)
|
| 619 |
|
| 620 |
with gr.Column():
|
| 621 |
+
img2vid_output = gr.Video(label="์์ฑ๋ ๋น๋์ค")
|
| 622 |
|
| 623 |
with gr.Row():
|
| 624 |
gr.Examples(
|
| 625 |
examples=[
|
| 626 |
[
|
| 627 |
"assets/i2v_i2.png",
|
| 628 |
+
"์ฌ์ฑ์ด ํฐ์ ์ ๊ธฐ ๋ฒ๋ ์์์ ๋๋ ๋ฌผ์ด ๋ด๊ธด ๋๋น๋ฅผ ์ ๊ณ ์์ต๋๋ค. ๋ณด๋ผ์ ๋งค๋ํ์ด๋ฅผ ๋ฐ๋ฅธ ๊ทธ๋
์ ์์ด ํ์ ๋๋น ์์์ ๋๋ฌด ์๊ฐ๋ฝ์ ์ํ์ผ๋ก ์์ง์
๋๋ค. ๋๋น๋ ๊ฒ์์ ๋ฒํผ๊ณผ ๋์งํธ ๋์คํ๋ ์ด๊ฐ ์๋ ํฐ์ ์ ๊ธฐ ๋ฒ๋ ์์ ๋์ฌ ์์ต๋๋ค. ๋ฒ๋๋ ์ค๋ฅธ์ชฝ ์๋ ๋ชจ์๋ฆฌ์ ๋นจ๊ฐ์๊ณผ ํฐ์ ์ฒดํฌ๋ฌด๋ฌ ์ฒ์ด ๋ถ๋ถ์ ์ผ๋ก ๋ณด์ด๋ ํฐ์ ์กฐ๋ฆฌ๋ ์์ ๋์ฌ ์์ต๋๋ค. ์นด๋ฉ๋ผ ๊ฐ๋๋ ์ ํํ ์์์ ๋ด๋ ค๋ค๋ณด๋ ๊ฐ๋์ด๋ฉฐ ์ฅ๋ฉด ๋ด๋ด ๊ณ ์ ๋์ด ์์ต๋๋ค. ์กฐ๋ช
์ ๋ฐ๊ณ ๊ณ ๋ฅธ ์ค์ฑ์ ์ธ ํฐ์ ๋น์ผ๋ก ์ฅ๋ฉด์ ๋น์ถฅ๋๋ค. ์ฅ๋ฉด์ ์ค์ ์์์ฒ๋ผ ๋ณด์
๋๋ค.",
|
| 629 |
+
"๋ฎ์ ํ์ง, ์ต์
์ ํ์ง, ๊ธฐํ, ์๊ณก๋, ์ผ๊ทธ๋ฌ์ง, ๋ชจ์
์ค๋ฏธ์ด, ๋ชจ์
์ํฐํฉํธ, ์ตํฉ๋ ์๊ฐ๋ฝ, ์๋ชป๋ ํด๋ถํ, ์ด์ํ ์, ์ถํ",
|
| 630 |
"assets/i2v_2.mp4",
|
| 631 |
],
|
| 632 |
[
|
| 633 |
"assets/i2v_i0.png",
|
| 634 |
+
"๊ธด ํ๋ฅด๋ ๋๋ ์ค๋ฅผ ์
์ ์ฌ์ฑ์ด ๋คํ์ ์์ ๋ฑ์ ์นด๋ฉ๋ผ๋ฅผ ํฅํ ์ฑ ์งํ์ ์ ๋ฐ๋ผ๋ณด๊ณ ์์ต๋๋ค. ๊ทธ๋
์ ๋จธ๋ฆฌ์นด๋ฝ์ ๊ธธ๊ณ ๋ฐ์ผ๋ฉฐ ๋ฑ ์๋๋ก ํ๋ฌ๋ด๋ฆฝ๋๋ค. ๊ทธ๋
๋ ํฐ ์ฐธ๋๋ฌด์ ๋๊ฒ ํผ์ง ๊ฐ์ง ์๋์ ์ ์์ต๋๋ค. ์ผ์ชฝ์ผ๋ก๋ ๋ง๋ผ๋ถ์ ์๋ ์์ ํด๋์ํ ๋ฏธ๊ตญ ์๋์ฐจ๊ฐ ์ฃผ์ฐจ๋์ด ์์ต๋๋ค. ๋ฉ๋ฆฌ์๋ ํ ๋์ ๋ถ์์ง ์๋์ฐจ๊ฐ ์์ผ๋ก ๋์ ์์ต๋๋ค. ์์ ํ๋์ ์ด๋์ด ํ๋์ ๋ฐฐ๊ฒฝ์ผ๋ก ๋ฐ์ ํฐ ๊ตฌ๋ฆ์ด ๊ทน์ ์ธ ์บ๋ฒ์ค๋ฅผ ์ด๋ฃจ๊ณ ์์ต๋๋ค. ์ ์ฒด ์ด๋ฏธ์ง๋ ํ๋ฐฑ์ผ๋ก, ๋น๊ณผ ๊ทธ๋ฆผ์์ ๋๋น๋ฅผ ๊ฐ์กฐํฉ๋๋ค. ์ฌ์ฑ์ด ์ฒ์ฒํ ์๋์ฐจ๋ฅผ ํฅํด ๊ฑธ์ด๊ฐ๊ณ ์์ต๋๋ค.",
|
| 635 |
+
"๋ฎ์ ํ์ง, ์ต์
์ ํ์ง, ๊ธฐํ, ์๊ณก๋, ์ผ๊ทธ๋ฌ์ง, ๋ชจ์
์ค๋ฏธ์ด, ๋ชจ์
์ํฐํฉํธ, ์ตํฉ๋ ์๊ฐ๋ฝ, ์๋ชป๋ ํด๋ถํ, ์ด์ํ ์, ์ถํ",
|
| 636 |
"assets/i2v_0.mp4",
|
| 637 |
],
|
| 638 |
[
|
| 639 |
"assets/i2v_i1.png",
|
| 640 |
+
"ํ ์์ ์์ด ๋์๊ธฐ ๋ฌผ๋ ์์์ ์ ํ ์กฐ๊ฐ์ ๋ชจ์ ์ก์ ์ ์ฐจ์ ์ผ๋ก ์๋ฟ ๋ชจ์์ ๋ง๋ค์ด๊ฐ๊ณ ์์ต๋๋ค. ํ๋ ์ ๋ฐ์ ์ฌ๋์ ์์ด ์ ํ ๋ก ๋ฎ์ฌ ์์ผ๋ฉฐ, ํ์ ํ๋ ๋์๊ธฐ ๋ฌผ๋ ์ค์์ ์ ํ ๋ฉ์ด๋ฆฌ๋ฅผ ๋ถ๋๋ฝ๊ฒ ๋๋ฅด๊ณ ์์ต๋๋ค. ์์ ์ํ์ผ๋ก ์์ง์ด๋ฉฐ, ์ ํ ์์ชฝ์ ์ ์ฐจ์ ์ผ๋ก ์๋ฟ ๋ชจ์์ ๋ง๋ค์ด๊ฐ๋๋ค. ์นด๋ฉ๋ผ๋ ๋์๊ธฐ ๋ฌผ๋ ๋ฐ๋ก ์์ ์์นํ์ฌ ์ ํ ๊ฐ ๋ชจ์ ์กํ๊ฐ๋ ๊ฒ์ ์กฐ๊ฐ๋๋ก ๋ณด์ฌ์ค๋๋ค. ์กฐ๋ช
์ ๋ฐ๊ณ ๊ณ ๋ฅด๋ฉฐ, ์ ํ ์ ๊ทธ๊ฒ์ ๋ค๋ฃจ๋ ์์ ๋ฐ๊ฒ ๋น์ถฅ๋๋ค. ์ฅ๋ฉด์ ์ค์ ์์์ฒ๋ผ ์ดฌ์๋์์ต๋๋ค.",
|
| 641 |
+
"๋ฎ์ ํ์ง, ์ต์
์ ํ์ง, ๊ธฐํ, ์๊ณก๋, ์ผ๊ทธ๋ฌ์ง, ๋ชจ์
์ค๋ฏธ์ด, ๋ชจ์
์ํฐํฉํธ, ์ตํฉ๋ ์๊ฐ๋ฝ, ์๋ชป๋ ํด๋ถํ, ์ด์ํ ์, ์ถํ",
|
| 642 |
"assets/i2v_1.mp4",
|
| 643 |
],
|
| 644 |
],
|
|
|
|
| 648 |
img2vid_negative_prompt,
|
| 649 |
img2vid_output,
|
| 650 |
],
|
| 651 |
+
label="์ด๋ฏธ์ง-๋น๋์ค ์์ฑ ์์",
|
| 652 |
)
|
| 653 |
|
| 654 |
+
# Event handlers
|
| 655 |
txt2vid_preset.change(
|
| 656 |
fn=preset_changed, inputs=[txt2vid_preset], outputs=txt2vid_advanced[3:]
|
| 657 |
)
|
|
|
|
| 694 |
if __name__ == "__main__":
|
| 695 |
iface.queue(max_size=64, default_concurrency_limit=1, api_open=False).launch(
|
| 696 |
share=True, show_api=False
|
| 697 |
+
)
|