openfree commited on
Commit
7facba8
ยท
verified ยท
1 Parent(s): 795d26f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -16
app.py CHANGED
@@ -480,25 +480,30 @@ def create_advanced_options():
480
  num_frames_slider,
481
  ]
482
 
 
 
483
 
484
- # ์‹œ๋‚˜๋ฆฌ์˜ค ๋ถ„์„ ๋ฐ ํ”„๋กฌํ”„ํŠธ ์ƒ์„ฑ์„ ์œ„ํ•œ ์‹œ์Šคํ…œ ํ”„๋กฌํ”„ํŠธ
485
- system_prompt_scenario = """๋‹น์‹ ์€ ์˜์ƒ ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ 5๊ฐœ์˜ ์„น์…˜์œผ๋กœ ๋‚˜๋ˆ„๊ณ  ๊ฐ๊ฐ์— ๋Œ€ํ•œ ๋น„๋””์˜ค ์ƒ์„ฑ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ž‘์„ฑํ•˜๋Š” ์ „๋ฌธ๊ฐ€์ž…๋‹ˆ๋‹ค.
486
- ์ฃผ์–ด์ง„ ์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ๋‹ค์Œ 5๊ฐœ ์„น์…˜์œผ๋กœ ๋‚˜๋ˆ„์–ด ๊ฐ๊ฐ์˜ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ƒ์„ฑํ•ด์ฃผ์„ธ์š”:
 
487
 
488
- 1. ๋ฐฐ๊ฒฝ ๋ฐ ํ•„์š”์„ฑ: ์ฃผ์ œ์˜ ๋ฐฐ๊ฒฝ๊ณผ ์ค‘์š”์„ฑ์„ ์‹œ๊ฐ์ ์œผ๋กœ ํ‘œํ˜„
489
- 2. ๋ฌธ์ œ ์ œ๊ธฐ ๋ฐ ํฅ๋ฏธ ์œ ๋ฐœ: ํ•ต์‹ฌ ๋ฌธ์ œ๋‚˜ ํฅ๋ฏธ๋กœ์šด ํฌ์ธํŠธ๋ฅผ ๋“œ๋ผ๋งˆํ‹ฑํ•˜๊ฒŒ ํ‘œํ˜„
490
- 3. ํ•ด๊ฒฐ์ฑ… ์ œ์‹œ: ์ฃผ์š” ํ•ด๊ฒฐ๋ฐฉ์•ˆ์ด๋‚˜ ์ ‘๊ทผ๋ฒ•์„ ์‹œ๊ฐ์ ์œผ๋กœ ์ œ์‹œ
491
- 4. ๋ณธ๋ก : ํ•ต์‹ฌ ๋‚ด์šฉ์„ ์ƒ์„ธํžˆ ์„ค๋ช…ํ•˜๋Š” ์‹œ๊ฐ์  ํ‘œํ˜„
492
- 5. ๊ฒฐ๋ก  ๋ฐ ๊ฐ•์กฐ: ์ฃผ์š” ํฌ์ธํŠธ๋ฅผ ๋‹ค์‹œ ํ•œ๋ฒˆ ๊ฐ•์กฐํ•˜๊ณ  ๋งˆ๋ฌด๋ฆฌ
 
493
 
494
  ๊ฐ ์„น์…˜์˜ ํ”„๋กฌํ”„ํŠธ๋Š” ๋‹ค์Œ ์š”์†Œ๋ฅผ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:
495
- - ์ฃผ์š” ์‹œ๊ฐ์  ์š”์†Œ์™€ ๋™์ž‘
496
- - ์นด๋ฉ”๋ผ ์›€์ง์ž„๊ณผ ์•ต๊ธ€
497
- - ์žฅ๋ฉด ์ „ํ™˜๊ณผ ํšจ๊ณผ
498
- - ๋ถ„์œ„๊ธฐ์™€ ํ†ค
499
- - ๋“ฑ์žฅ ์š”์†Œ๋“ค์˜ ์„ธ๋ถ€ ๋ฌ˜์‚ฌ
 
 
500
 
501
- ๊ฐ ์„น์…˜์€ 10์ดˆ ๋ถ„๋Ÿ‰์˜ ์˜์ƒ์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ตฌ์ฒด์ ์ด๊ณ  ์‹œ๊ฐ์ ์ธ ์„ค๋ช…์„ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค."""
502
 
503
  def analyze_scenario(scenario):
504
  """์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ๋ถ„์„ํ•˜์—ฌ 5๊ฐœ์˜ ์„น์…˜์œผ๋กœ ๋‚˜๋ˆ„๊ณ  ๊ฐ๊ฐ์˜ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ƒ์„ฑ"""
@@ -537,14 +542,19 @@ def analyze_scenario(scenario):
537
  print(f"Error during scenario analysis: {e}")
538
  return ["Error occurred during analysis"] * 5
539
 
540
- def generate_section_video(prompt, preset, progress=gr.Progress()):
541
- """๊ฐ ์„น์…˜์˜ ๋น„๋””์˜ค ์ƒ์„ฑ"""
542
  selected = next(item for item in preset_options if item["label"] == preset)
 
 
 
 
543
  return generate_video_from_text(
544
  prompt=prompt,
545
  height=selected["height"],
546
  width=selected["width"],
547
  num_frames=selected["num_frames"],
 
548
  progress=progress
549
  )
550
 
 
480
  num_frames_slider,
481
  ]
482
 
483
+ system_prompt_scenario = """๋‹น์‹ ์€ ์˜์ƒ ์Šคํฌ๋ฆฝํŠธ์— ๋งž๋Š” ๋ฐฐ๊ฒฝ ์˜์ƒ์„ ์ƒ์„ฑํ•˜๊ธฐ ์œ„ํ•œ ํ”„๋กฌํ”„ํŠธ ์ „๋ฌธ๊ฐ€์ž…๋‹ˆ๋‹ค.
484
+ ์ฃผ์–ด์ง„ ์Šคํฌ๋ฆฝํŠธ์˜ ๋ถ„์œ„๊ธฐ์™€ ๋งฅ๋ฝ์„ ์‹œ๊ฐ์  ๋ฐฐ๊ฒฝ์œผ๋กœ ํ‘œํ˜„ํ•˜๋˜, ๋‹ค์Œ ์›์น™์„ ๋ฐ˜๋“œ์‹œ ์ค€์ˆ˜ํ•˜์„ธ์š”:
485
 
486
+ 1. ์ œํ’ˆ์ด๋‚˜ ์„œ๋น„์Šค๋ฅผ ์ง์ ‘์ ์œผ๋กœ ๋ฌ˜์‚ฌํ•˜์ง€ ๋ง ๊ฒƒ
487
+ 2. ์Šคํฌ๋ฆฝํŠธ์˜ ๊ฐ์„ฑ๊ณผ ํ†ค์•ค๋งค๋„ˆ๋ฅผ ํ‘œํ˜„ํ•˜๋Š” ๋ฐฐ๊ฒฝ ์˜์ƒ์— ์ง‘์ค‘ํ•  ๊ฒƒ
488
+ 3. 5๊ฐœ ์„น์…˜์ด ํ•˜๋‚˜์˜ ์ด์•ผ๊ธฐ์ฒ˜๋Ÿผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์—ฐ๊ฒฐ๋˜๋„๋ก ํ•  ๊ฒƒ
489
+ 4. ์ถ”์ƒ์ ์ด๊ณ  ์€์œ ์ ์ธ ์‹œ๊ฐ ํ‘œํ˜„์„ ํ™œ์šฉํ•  ๊ฒƒ
490
 
491
+ ๊ฐ ์„น์…˜๋ณ„ ํ”„๋กฌํ”„ํŠธ ์ž‘์„ฑ ๊ฐ€์ด๋“œ:
492
+ 1. ๋ฐฐ๊ฒฝ ๋ฐ ํ•„์š”์„ฑ: ์ฃผ์ œ์˜ ์ „๋ฐ˜์ ์ธ ๋ถ„์œ„๊ธฐ๋ฅผ ํ‘œํ˜„ํ•˜๋Š” ๋ฐฐ๊ฒฝ ์”ฌ
493
+ 2. ๋ฌธ์ œ ์ œ๊ธฐ: ๊ธด์žฅ๊ฐ์ด๋‚˜ ๊ฐˆ๋“ฑ์„ ์•”์‹œํ•˜๋Š” ๋ถ„์œ„๊ธฐ ์žˆ๋Š” ๋ฐฐ๊ฒฝ
494
+ 3. ํ•ด๊ฒฐ์ฑ… ์ œ์‹œ: ํฌ๋ง์ ์ด๊ณ  ๋ฐ์€ ํ†ค์˜ ๋ฐฐ๊ฒฝ ์ „ํ™˜
495
+ 4. ๋ณธ๋ก : ์•ˆ์ •๊ฐ ์žˆ๊ณ  ์‹ ๋ขฐ๋„๋ฅผ ๋†’์ด๋Š” ๋ฐฐ๊ฒฝ
496
+ 5. ๊ฒฐ๋ก : ์ž„ํŒฉํŠธ ์žˆ๋Š” ๋งˆ๋ฌด๋ฆฌ๋ฅผ ์œ„ํ•œ ์—ญ๋™์ ์ธ ๋ฐฐ๊ฒฝ
497
 
498
  ๊ฐ ์„น์…˜์˜ ํ”„๋กฌํ”„ํŠธ๋Š” ๋‹ค์Œ ์š”์†Œ๋ฅผ ํฌํ•จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:
499
+ - ๋ฐฐ๊ฒฝ์˜ ์ฃผ์š” ์‹œ๊ฐ์  ์š”์†Œ์™€ ์›€์ง์ž„
500
+ - ์นด๋ฉ”๋ผ ์›Œํฌ์™€ ์•ต๊ธ€
501
+ - ์กฐ๋ช…๊ณผ ์ƒ‰๊ฐ์˜ ๋ณ€ํ™”
502
+ - ์ „์ฒด์ ์ธ ๋ถ„์œ„๊ธฐ์™€ ๊ฐ์„ฑ
503
+ - ์žฅ๋ฉด ์ „ํ™˜ ํšจ๊ณผ
504
+
505
+ ๋ชจ๋“  ์„น์…˜์ด ์ผ๊ด€๋œ ์Šคํƒ€์ผ๊ณผ ํ†ค์„ ์œ ์ง€ํ•˜๋ฉด์„œ๋„ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ด์–ด์ง€๋„๋ก ๊ตฌ์„ฑํ•˜์„ธ์š”."""
506
 
 
507
 
508
  def analyze_scenario(scenario):
509
  """์‹œ๋‚˜๋ฆฌ์˜ค๋ฅผ ๋ถ„์„ํ•˜์—ฌ 5๊ฐœ์˜ ์„น์…˜์œผ๋กœ ๋‚˜๋ˆ„๊ณ  ๊ฐ๊ฐ์˜ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ƒ์„ฑ"""
 
542
  print(f"Error during scenario analysis: {e}")
543
  return ["Error occurred during analysis"] * 5
544
 
545
+ def generate_section_video(prompt, preset, section_number=1, base_seed=171198, progress=gr.Progress()):
546
+ """๊ฐ ์„น์…˜์˜ ๋น„๋””์˜ค ์ƒ์„ฑ - ์ผ๊ด€๋œ SEED ๊ฐ’ ์‚ฌ์šฉ"""
547
  selected = next(item for item in preset_options if item["label"] == preset)
548
+
549
+ # ๊ธฐ๋ณธ SEED์— ์„น์…˜ ๋ฒˆํ˜ธ๋ฅผ ๋”ํ•ด ์•ฝ๊ฐ„์˜ ๋ณ€ํ™”๋ฅผ ์ฃผ๋˜ ์ผ๊ด€์„ฑ ์œ ์ง€
550
+ section_seed = base_seed + section_number
551
+
552
  return generate_video_from_text(
553
  prompt=prompt,
554
  height=selected["height"],
555
  width=selected["width"],
556
  num_frames=selected["num_frames"],
557
+ seed=section_seed, # ์„น์…˜๋ณ„ ๊ณ ์œ  SEED ์‚ฌ์šฉ
558
  progress=progress
559
  )
560