openfree commited on
Commit
12996e6
·
verified ·
1 Parent(s): 777438e

Update app-backup1.py

Browse files
Files changed (1) hide show
  1. app-backup1.py +104 -113
app-backup1.py CHANGED
@@ -196,39 +196,39 @@ pipeline = XoraVideoPipeline(
196
  ).to(device)
197
 
198
  # Preset options for resolution and frame configuration
 
199
  preset_options = [
200
- {"label": "1216x704, 41 frames", "width": 1216, "height": 704, "num_frames": 41},
201
- {"label": "1088x704, 49 frames", "width": 1088, "height": 704, "num_frames": 49},
202
- {"label": "1056x640, 57 frames", "width": 1056, "height": 640, "num_frames": 57},
203
- {"label": "992x608, 65 frames", "width": 992, "height": 608, "num_frames": 65},
204
- {"label": "896x608, 73 frames", "width": 896, "height": 608, "num_frames": 73},
205
- {"label": "896x544, 81 frames", "width": 896, "height": 544, "num_frames": 81},
206
- {"label": "832x544, 89 frames", "width": 832, "height": 544, "num_frames": 89},
207
- {"label": "800x512, 97 frames", "width": 800, "height": 512, "num_frames": 97},
208
- {"label": "768x512, 97 frames", "width": 768, "height": 512, "num_frames": 97},
209
- {"label": "800x480, 105 frames", "width": 800, "height": 480, "num_frames": 105},
210
- {"label": "736x480, 113 frames", "width": 736, "height": 480, "num_frames": 113},
211
- {"label": "704x480, 121 frames", "width": 704, "height": 480, "num_frames": 121},
212
- {"label": "704x448, 129 frames", "width": 704, "height": 448, "num_frames": 129},
213
- {"label": "672x448, 137 frames", "width": 672, "height": 448, "num_frames": 137},
214
- {"label": "640x416, 153 frames", "width": 640, "height": 416, "num_frames": 153},
215
- {"label": "672x384, 161 frames", "width": 672, "height": 384, "num_frames": 161},
216
- {"label": "640x384, 169 frames", "width": 640, "height": 384, "num_frames": 169},
217
- {"label": "608x384, 177 frames", "width": 608, "height": 384, "num_frames": 177},
218
- {"label": "576x384, 185 frames", "width": 576, "height": 384, "num_frames": 185},
219
- {"label": "608x352, 193 frames", "width": 608, "height": 352, "num_frames": 193},
220
- {"label": "576x352, 201 frames", "width": 576, "height": 352, "num_frames": 201},
221
- {"label": "544x352, 209 frames", "width": 544, "height": 352, "num_frames": 209},
222
- {"label": "512x352, 225 frames", "width": 512, "height": 352, "num_frames": 225},
223
- {"label": "512x352, 233 frames", "width": 512, "height": 352, "num_frames": 233},
224
- {"label": "544x320, 241 frames", "width": 544, "height": 320, "num_frames": 241},
225
- {"label": "512x320, 249 frames", "width": 512, "height": 320, "num_frames": 249},
226
- {"label": "512x320, 257 frames", "width": 512, "height": 320, "num_frames": 257},
227
  ]
228
 
229
  def preset_changed(preset):
230
  if preset != "Custom":
231
  selected = next(item for item in preset_options if item["label"] == preset)
 
232
  return (
233
  selected["height"],
234
  selected["width"],
@@ -247,17 +247,18 @@ def preset_changed(preset):
247
  gr.update(visible=True),
248
  )
249
 
 
250
  def generate_video_from_text(
251
  prompt="",
252
  enhance_prompt_toggle=False,
253
- negative_prompt="",
254
  frame_rate=25,
255
  seed=171198,
256
- num_inference_steps=30,
257
- guidance_scale=3,
258
  height=512,
259
- width=768,
260
- num_frames=121,
261
  progress=gr.Progress(),
262
  ):
263
  if len(prompt.strip()) < 50:
@@ -331,11 +332,11 @@ def generate_video_from_image(
331
  image_path,
332
  prompt="",
333
  enhance_prompt_toggle=False,
334
- negative_prompt="",
335
  frame_rate=25,
336
  seed=171198,
337
- num_inference_steps=30,
338
- guidance_scale=3,
339
  height=512,
340
  width=768,
341
  num_frames=121,
@@ -420,15 +421,28 @@ def generate_video_from_image(
420
  def create_advanced_options():
421
  with gr.Accordion("Step 4: Advanced Options (Optional)", open=False):
422
  seed = gr.Slider(
423
- label="4.1 Seed", minimum=0, maximum=1000000, step=1, value=171198
 
 
 
 
424
  )
425
  inference_steps = gr.Slider(
426
- label="4.2 Inference Steps", minimum=1, maximum=50, step=1, value=30
 
 
 
 
 
427
  )
428
  guidance_scale = gr.Slider(
429
- label="4.3 Guidance Scale", minimum=1.0, maximum=5.0, step=0.1, value=3.0
 
 
 
 
 
430
  )
431
-
432
  height_slider = gr.Slider(
433
  label="4.4 Height",
434
  minimum=256,
@@ -473,7 +487,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
473
  txt2vid_prompt = gr.Textbox(
474
  label="Step 1: 프롬프트 입력",
475
  placeholder="생성하고 싶은 비디오를 설명하세요 (최소 50자)...",
476
- value="갈색 긴 머리를 가진 여성이 금발의 긴 머리를 가진 다른 여성을 향해 미소짓습니다. 갈색 머리의 여성은 검은색 자켓을 입고 있으며 오른쪽 뺨에 작은 점이 있습니다. 카메라 각도는 갈색 머리 여성의 얼굴에 클로즈업되어 있습니다. 조명은 자연스럽고 따뜻하며, 석양에서 오는 듯한 부드러운 빛이 장면을 비춥니다. 장면은 실제 영상처럼 보입니다.",
477
  lines=5,
478
  )
479
  txt2vid_enhance_toggle = Toggle(
@@ -487,25 +501,32 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
487
  placeholder="비디오에서 원하지 않는 요소를 설명하세요...",
488
  value="low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
489
  lines=2,
 
490
  )
491
 
 
 
 
 
 
492
  txt2vid_preset = gr.Dropdown(
493
  choices=[p["label"] for p in preset_options],
494
- value="768x512, 97 frames",
495
- label="Step 3.1: 해상도 프리셋 선택",
496
  )
497
 
498
  txt2vid_frame_rate = gr.Slider(
499
- label="Step 3.2: 프레임 레이트",
500
  minimum=21,
501
  maximum=30,
502
  step=1,
503
  value=25,
 
504
  )
505
 
506
  txt2vid_advanced = create_advanced_options()
507
  txt2vid_generate = gr.Button(
508
- "Step 5: 비디오 생성",
509
  variant="primary",
510
  size="lg",
511
  )
@@ -513,29 +534,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
513
  with gr.Column():
514
  txt2vid_output = gr.Video(label="생성된 비디오")
515
 
516
- with gr.Row():
517
- gr.Examples(
518
- examples=[
519
- [
520
- "전통적인 몽골 드레스를 입은 젊은 여성이 얇은 흰색 커튼을 통해 호기심과 긴장이 섞인 표정으로 들여다보고 있습니다. 여성은 흰 구슬로 장식된 두 개의 땋은 머리로 스타일링된 긴 검은 머리를 하고 있으며, 눈은 놀람을 띄며 크게 떠져 있습니다. 그녀의 드레스는 화려한 금색 자수가 새겨진 선명한 파란색이며, 비슷한 디자인의 머리띠를 하고 있습니다. 배경은 신비로움과 호기심을 자아내는 단순한 흰색 커튼입니다.",
521
- "low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
522
- "assets/t2v_2.mp4",
523
- ],
524
- [
525
- "노란색 재킷을 입은 금발 머리의 젊은 남자가 숲에 서서 주위를 둘러봅니다. 그는 밝은 피부를 가졌고 머리는 가운데 가르마로 스타일링되어 있습니다. 그는 왼쪽을 보고 난 후 오른쪽을 보며, 각 방향을 잠시 응시합니다. 카메라는 낮은 각도에서 남자를 올려다보며 고정되어 있습니다. 배경은 약간 흐릿하며, 녹색 나무들과 남자의 뒤에서 밝게 비치는 태양이 보입니다. 조명은 자연스럽고 따뜻하며, 태양 빛이 남자의 얼굴을 가로지르는 렌즈 플레어를 만듭니다. 장면은 실제 영상처럼 촬영되었습니다.",
526
- "low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
527
- "assets/t2v_1.mp4",
528
- ],
529
- [
530
- "한 사이클리스트가 굽이진 산길을 따라 달립니다. 공기역학적인 장비를 입은 그는 강하게 페달을 밟고 있으며, 이마에는 땀방울이 반짝입니다. 카메라는 그의 결연한 표정과 숨 막히는 풍경을 번갈아가며 보여줍니다. 소나무들이 스쳐 지나가고, 하늘은 선명한 파란색입니다. 이 장면은 활기차고 경쟁적인 분위기를 자아냅니다.",
531
- "low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
532
- "assets/t2v_0.mp4",
533
- ],
534
- ],
535
- inputs=[txt2vid_prompt, txt2vid_negative_prompt, txt2vid_output],
536
- label="텍스트-비디오 생성 예시",
537
- )
538
-
539
  # Image to Video Tab
540
  with gr.TabItem("이미지로 비디오 만들기"):
541
  with gr.Row():
@@ -548,11 +546,11 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
548
  img2vid_prompt = gr.Textbox(
549
  label="Step 2: 프롬프트 입력",
550
  placeholder="이미지를 어떻게 애니메이션화할지 설명하세요 (최소 50자)...",
551
- value="갈색 긴 머리를 가진 여성이 금발의 긴 머리를 가진 다른 여성을 향해 미소짓습니다. 갈색 머리의 여성은 검은색 자켓을 입고 있으며 오른쪽 뺨에 작은 점이 있습니다. 카메라 각도는 갈색 머리 여성의 얼굴에 클로즈업되어 있습니다. 조명은 자연스럽고 따뜻하며, 석양에서 오는 듯한 부드러운 빛이 장면을 비춥니다. 장면은 실제 영상처럼 보입니다.",
552
  lines=5,
553
  )
554
  img2vid_enhance_toggle = Toggle(
555
- label="프롬프트 개선",
556
  value=False,
557
  interactive=True,
558
  )
@@ -561,67 +559,49 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
561
  placeholder="비디오에서 원하지 않는 요소를 설명하세요...",
562
  value="low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
563
  lines=2,
 
564
  )
565
 
 
 
 
 
 
566
  img2vid_preset = gr.Dropdown(
567
  choices=[p["label"] for p in preset_options],
568
- value="768x512, 97 frames",
569
- label="Step 3.1: 해상도 프리셋 선택",
570
  )
571
 
572
  img2vid_frame_rate = gr.Slider(
573
- label="Step 3.2: 프레임 레이트",
574
  minimum=21,
575
  maximum=30,
576
  step=1,
577
  value=25,
 
578
  )
579
 
580
  img2vid_advanced = create_advanced_options()
581
  img2vid_generate = gr.Button(
582
- "Step 6: 비디오 생성", variant="primary", size="lg"
 
 
583
  )
584
 
585
  with gr.Column():
586
  img2vid_output = gr.Video(label="생성된 비디오")
587
 
588
- with gr.Row():
589
- gr.Examples(
590
- examples=[
591
- [
592
- "assets/i2v_i2.png",
593
- "여성이 흰색 전기 버너 위에서 끓는 물이 담긴 냄비를 젓고 있습니다. 보라색 매니큐어를 바른 그녀의 손이 하얀 냄비 안에서 나무 숟가락을 원형으로 움직입니다. 냄비는 검은색 버튼과 디지털 디스플레이가 있는 흰색 전기 버너 위에 놓여 있습니다. 버너는 오른쪽 아래 모서리에 빨간색과 흰색 체크무늬 천이 부분적으로 보이는 흰색 조리대 위에 놓여 있습니다. 카메라 각도는 정확히 위에서 내려다보는 각도이며 장면 내내 고정되어 있습니다. 조명은 밝고 고른 중성적인 흰색 빛으로 장면을 비춥니다. 장면은 실제 영상처럼 보입니다.",
594
- "low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
595
- "assets/i2v_2.mp4",
596
- ],
597
- [
598
- "assets/i2v_i0.png",
599
- "긴 흐르는 드레스를 입은 여성이 들판에 서서 등을 카메라를 향한 채 지평선을 바라보고 있습니다. 그녀의 머리카락은 길고 밝으며 등 아래로 흘러내립니다. 그녀는 큰 참나무의 넓게 퍼진 가지 아래에 서 있습니다. 왼쪽으로는 말라붙은 잔디 위에 클래식한 미국 자동차가 주차되어 있습니다. 멀리서는 한 대의 부서진 자동차가 옆으로 누워 있습니다. 위의 하늘은 어두운 하늘을 배경으로 밝은 흰 구름이 극적인 캔버스를 이루고 있습니다. 전체 이미지는 흑백으로, 빛과 그림자의 대비를 강조합니다. 여성이 천천히 자동차를 향해 걸어가고 있습니다.",
600
- "low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
601
- "assets/i2v_0.mp4",
602
- ],
603
- [
604
- "assets/i2v_i1.png",
605
- "한 쌍의 손이 도자기 물레 위에서 점토 조각을 모양 잡아 점차적으로 원뿔 모양을 만들어가고 있습니다. 프레임 밖의 사람의 손이 점토로 덮여 있으며, 회전하는 도자기 물레 중앙에 점토 덩어리를 부드럽게 누르고 있습니다. 손은 원형으로 움직이며, 점토 위쪽에 점차적으로 원뿔 모양을 만들어갑니다. 카메라는 도자기 물레 바로 위에 위치하여 점토가 모양 잡혀가는 것을 조감도로 보여줍니다. 조명은 밝고 고르며, 점토와 그것을 다루는 손을 밝게 비춥니다. 장면은 실제 영상처럼 촬영되었습니다.",
606
- "low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
607
- "assets/i2v_1.mp4",
608
- ],
609
- ],
610
- inputs=[
611
- img2vid_image,
612
- img2vid_prompt,
613
- img2vid_negative_prompt,
614
- img2vid_output,
615
- ],
616
- label="이미지-비디오 생성 예시",
617
- )
618
-
619
  # Event handlers
620
- # Event handlers
621
  txt2vid_preset.change(
622
- fn=preset_changed,
623
- inputs=[txt2vid_preset],
624
- outputs=txt2vid_advanced[3:]
 
 
 
 
 
625
  )
626
 
627
  txt2vid_enhance_toggle.change(
@@ -637,7 +617,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
637
  txt2vid_enhance_toggle,
638
  txt2vid_negative_prompt,
639
  txt2vid_frame_rate,
640
- *txt2vid_advanced,
 
 
 
641
  ],
642
  outputs=txt2vid_output,
643
  concurrency_limit=1,
@@ -646,9 +629,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
646
  )
647
 
648
  img2vid_preset.change(
649
- fn=preset_changed,
650
- inputs=[img2vid_preset],
651
- outputs=img2vid_advanced[3:]
 
 
 
 
 
652
  )
653
 
654
  img2vid_enhance_toggle.change(
@@ -665,7 +653,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as iface:
665
  img2vid_enhance_toggle,
666
  img2vid_negative_prompt,
667
  img2vid_frame_rate,
668
- *img2vid_advanced,
 
 
 
669
  ],
670
  outputs=img2vid_output,
671
  concurrency_limit=1,
 
196
  ).to(device)
197
 
198
  # Preset options for resolution and frame configuration
199
+ # Convert frames to seconds assuming 25 FPS
200
  preset_options = [
201
+ {"label": "1216x704, 1.6초", "width": 1216, "height": 704, "num_frames": 41},
202
+ {"label": "1088x704, 2.0초", "width": 1088, "height": 704, "num_frames": 49},
203
+ {"label": "1056x640, 2.3초", "width": 1056, "height": 640, "num_frames": 57},
204
+ {"label": "992x608, 2.6초", "width": 992, "height": 608, "num_frames": 65},
205
+ {"label": "896x608, 2.9초", "width": 896, "height": 608, "num_frames": 73},
206
+ {"label": "896x544, 3.2초", "width": 896, "height": 544, "num_frames": 81},
207
+ {"label": "832x544, 3.6초", "width": 832, "height": 544, "num_frames": 89},
208
+ {"label": "800x512, 3.9초", "width": 800, "height": 512, "num_frames": 97},
209
+ {"label": "768x512, 3.9초", "width": 768, "height": 512, "num_frames": 97},
210
+ {"label": "800x480, 4.2초", "width": 800, "height": 480, "num_frames": 105},
211
+ {"label": "736x480, 4.5초", "width": 736, "height": 480, "num_frames": 113},
212
+ {"label": "704x480, 4.8초", "width": 704, "height": 480, "num_frames": 121},
213
+ {"label": "704x448, 5.2초", "width": 704, "height": 448, "num_frames": 129},
214
+ {"label": "672x448, 5.5초", "width": 672, "height": 448, "num_frames": 137},
215
+ {"label": "640x416, 6.1초", "width": 640, "height": 416, "num_frames": 153},
216
+ {"label": "672x384, 6.4초", "width": 672, "height": 384, "num_frames": 161},
217
+ {"label": "640x384, 6.8초", "width": 640, "height": 384, "num_frames": 169},
218
+ {"label": "608x384, 7.1초", "width": 608, "height": 384, "num_frames": 177},
219
+ {"label": "576x384, 7.4초", "width": 576, "height": 384, "num_frames": 185},
220
+ {"label": "608x352, 7.7초", "width": 608, "height": 352, "num_frames": 193},
221
+ {"label": "576x352, 8.0초", "width": 576, "height": 352, "num_frames": 201},
222
+ {"label": "544x352, 8.4초", "width": 544, "height": 352, "num_frames": 209},
223
+ {"label": "512x352, 9.3초", "width": 512, "height": 352, "num_frames": 233},
224
+ {"label": "544x320, 9.6초", "width": 544, "height": 320, "num_frames": 241},
225
+ {"label": "512x320, 10.3초", "width": 512, "height": 320, "num_frames": 257},
 
 
226
  ]
227
 
228
  def preset_changed(preset):
229
  if preset != "Custom":
230
  selected = next(item for item in preset_options if item["label"] == preset)
231
+ # height, width, num_frames 값을 global 변수로 업데이트
232
  return (
233
  selected["height"],
234
  selected["width"],
 
247
  gr.update(visible=True),
248
  )
249
 
250
+
251
  def generate_video_from_text(
252
  prompt="",
253
  enhance_prompt_toggle=False,
254
+ negative_prompt="low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
255
  frame_rate=25,
256
  seed=171198,
257
+ num_inference_steps=41,
258
+ guidance_scale=4,
259
  height=512,
260
+ width=320,
261
+ num_frames=257,
262
  progress=gr.Progress(),
263
  ):
264
  if len(prompt.strip()) < 50:
 
332
  image_path,
333
  prompt="",
334
  enhance_prompt_toggle=False,
335
+ negative_prompt="low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
336
  frame_rate=25,
337
  seed=171198,
338
+ num_inference_steps=50,
339
+ guidance_scale=4,
340
  height=512,
341
  width=768,
342
  num_frames=121,
 
421
  def create_advanced_options():
422
  with gr.Accordion("Step 4: Advanced Options (Optional)", open=False):
423
  seed = gr.Slider(
424
+ label="Seed",
425
+ minimum=0,
426
+ maximum=1000000,
427
+ step=1,
428
+ value=171198
429
  )
430
  inference_steps = gr.Slider(
431
+ label="4.2 Inference Steps",
432
+ minimum=1,
433
+ maximum=50,
434
+ step=1,
435
+ value=50,
436
+ visible=False
437
  )
438
  guidance_scale = gr.Slider(
439
+ label="4.3 Guidance Scale",
440
+ minimum=1.0,
441
+ maximum=5.0,
442
+ step=0.1,
443
+ value=4.0,
444
+ visible=False
445
  )
 
446
  height_slider = gr.Slider(
447
  label="4.4 Height",
448
  minimum=256,
 
487
  txt2vid_prompt = gr.Textbox(
488
  label="Step 1: 프롬프트 입력",
489
  placeholder="생성하고 싶은 비디오를 설명하세요 (최소 50자)...",
490
+ value="귀여운 고양이",
491
  lines=5,
492
  )
493
  txt2vid_enhance_toggle = Toggle(
 
501
  placeholder="비디오에서 원하지 않는 요소를 설명하세요...",
502
  value="low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
503
  lines=2,
504
+ visible=False
505
  )
506
 
507
+ # 현재 선택된 값들을 저장할 상태 변수들
508
+ txt2vid_current_height = gr.State(value=512)
509
+ txt2vid_current_width = gr.State(value=320)
510
+ txt2vid_current_num_frames = gr.State(value=257)
511
+
512
  txt2vid_preset = gr.Dropdown(
513
  choices=[p["label"] for p in preset_options],
514
+ value="512x320, 10.3초",
515
+ label="Step 2: 해상도 프리셋 선택",
516
  )
517
 
518
  txt2vid_frame_rate = gr.Slider(
519
+ label="Step 3: 프레임 레이트",
520
  minimum=21,
521
  maximum=30,
522
  step=1,
523
  value=25,
524
+ visible=False
525
  )
526
 
527
  txt2vid_advanced = create_advanced_options()
528
  txt2vid_generate = gr.Button(
529
+ "Step 3: 비디오 생성",
530
  variant="primary",
531
  size="lg",
532
  )
 
534
  with gr.Column():
535
  txt2vid_output = gr.Video(label="생성된 비디오")
536
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
537
  # Image to Video Tab
538
  with gr.TabItem("이미지로 비디오 만들기"):
539
  with gr.Row():
 
546
  img2vid_prompt = gr.Textbox(
547
  label="Step 2: 프롬프트 입력",
548
  placeholder="이미지를 어떻게 애니메이션화할지 설명하세요 (최소 50자)...",
549
+ value="귀여운 고양이",
550
  lines=5,
551
  )
552
  img2vid_enhance_toggle = Toggle(
553
+ label="프롬프트 증강",
554
  value=False,
555
  interactive=True,
556
  )
 
559
  placeholder="비디오에서 원하지 않는 요소를 설명하세요...",
560
  value="low quality, worst quality, deformed, distorted, warped, motion smear, motion artifacts, fused fingers, incorrect anatomy, strange hands, unattractive",
561
  lines=2,
562
+ visible=False
563
  )
564
 
565
+ # 현재 선택된 값들을 저장할 상태 변수들
566
+ img2vid_current_height = gr.State(value=512)
567
+ img2vid_current_width = gr.State(value=768)
568
+ img2vid_current_num_frames = gr.State(value=97)
569
+
570
  img2vid_preset = gr.Dropdown(
571
  choices=[p["label"] for p in preset_options],
572
+ value="512x320, 10.3초",
573
+ label="Step 3: 해상도 프리셋 선택",
574
  )
575
 
576
  img2vid_frame_rate = gr.Slider(
577
+ label="Step 4: 프레임 레이트",
578
  minimum=21,
579
  maximum=30,
580
  step=1,
581
  value=25,
582
+ visible=False
583
  )
584
 
585
  img2vid_advanced = create_advanced_options()
586
  img2vid_generate = gr.Button(
587
+ "Step 4: 비디오 생성",
588
+ variant="primary",
589
+ size="lg",
590
  )
591
 
592
  with gr.Column():
593
  img2vid_output = gr.Video(label="생성된 비디오")
594
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
595
  # Event handlers
 
596
  txt2vid_preset.change(
597
+ fn=preset_changed,
598
+ inputs=[txt2vid_preset],
599
+ outputs=[
600
+ txt2vid_current_height,
601
+ txt2vid_current_width,
602
+ txt2vid_current_num_frames,
603
+ *txt2vid_advanced[3:]
604
+ ]
605
  )
606
 
607
  txt2vid_enhance_toggle.change(
 
617
  txt2vid_enhance_toggle,
618
  txt2vid_negative_prompt,
619
  txt2vid_frame_rate,
620
+ *txt2vid_advanced[:3], # seed, inference_steps, guidance_scale
621
+ txt2vid_current_height,
622
+ txt2vid_current_width,
623
+ txt2vid_current_num_frames,
624
  ],
625
  outputs=txt2vid_output,
626
  concurrency_limit=1,
 
629
  )
630
 
631
  img2vid_preset.change(
632
+ fn=preset_changed,
633
+ inputs=[img2vid_preset],
634
+ outputs=[
635
+ img2vid_current_height,
636
+ img2vid_current_width,
637
+ img2vid_current_num_frames,
638
+ *img2vid_advanced[3:]
639
+ ]
640
  )
641
 
642
  img2vid_enhance_toggle.change(
 
653
  img2vid_enhance_toggle,
654
  img2vid_negative_prompt,
655
  img2vid_frame_rate,
656
+ *img2vid_advanced[:3], # seed, inference_steps, guidance_scale
657
+ img2vid_current_height,
658
+ img2vid_current_width,
659
+ img2vid_current_num_frames,
660
  ],
661
  outputs=img2vid_output,
662
  concurrency_limit=1,