openfree commited on
Commit
16e0398
ยท
verified ยท
1 Parent(s): f21f907

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -33
app.py CHANGED
@@ -120,7 +120,7 @@ def load_image_to_tensor_with_resize(image_path, target_height=512, target_width
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)
124
  return prompt
125
 
126
  system_prompt = system_prompt_t2v if type == "t2v" else system_prompt_i2v
@@ -135,10 +135,18 @@ def enhance_prompt_if_enabled(prompt, enhance_toggle, type="t2v"):
135
  messages=messages,
136
  max_tokens=200,
137
  )
138
- print("Enhanced Prompt: ", response.choices[0].message.content.strip())
139
- return response.choices[0].message.content.strip()
 
 
 
 
 
 
 
 
140
  except Exception as e:
141
- print(f"Error: {e}")
142
  return prompt
143
 
144
  # Preset options for resolution and frame configuration
@@ -442,35 +450,6 @@ def create_advanced_options():
442
  with gr.Blocks(theme=gr.themes.Soft()) as iface:
443
 
444
 
445
- with gr.Accordion(
446
- " ๐Ÿ“– Tips for Best Results", open=False, elem_id="instructions-accordion"
447
- ):
448
- gr.Markdown(
449
- """
450
- ๐Ÿ“ ํ”„๋กฌํ”„ํŠธ ์ž‘์„ฑ ํŒ
451
-
452
- ํ”„๋กฌํ”„ํŠธ ์ž‘์„ฑ ์‹œ ๋™์ž‘๊ณผ ์žฅ๋ฉด์— ๋Œ€ํ•œ ์ƒ์„ธํ•˜๊ณ  ์‹œ๊ฐ„ ์ˆœ์„œ๋Œ€๋กœ ๋œ ์„ค๋ช…์— ์ง‘์ค‘ํ•˜์„ธ์š”. ๊ตฌ์ฒด์ ์ธ ์›€์ง์ž„, ์™ธ๋ชจ, ์นด๋ฉ”๋ผ ๊ฐ๋„, ํ™˜๊ฒฝ ์„ธ๋ถ€ ์‚ฌํ•ญ์„ ํฌํ•จํ•˜๋˜ ํ•˜๋‚˜์˜ ๋ฌธ๋‹จ์œผ๋กœ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ž‘์„ฑํ•˜์„ธ์š”. ๋™์ž‘์œผ๋กœ ๋ฐ”๋กœ ์‹œ์ž‘ํ•˜๊ณ , ์„ค๋ช…์€ ๋ฌธ์ž ๊ทธ๋Œ€๋กœ ์ •ํ™•ํ•˜๊ฒŒ ํ•ด์ฃผ์„ธ์š”. ์ดฌ์˜ ๊ฐ๋…์ด ์ดฌ์˜ ๋ชฉ๋ก์„ ์„ค๋ช…ํ•˜๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ์ƒ๊ฐํ•˜์„ธ์š”. 200๋‹จ์–ด ์ด๋‚ด๋กœ ์ž‘์„ฑํ•˜์„ธ์š”.
453
-
454
- ํ”„๋กฌํ”„ํŠธ๋Š” ๋‹ค์Œ ๊ตฌ์กฐ๋กœ ์ž‘์„ฑํ•˜๋ฉด ์ข‹์Šต๋‹ˆ๋‹ค:
455
-
456
- - ์ฃผ์š” ๋™์ž‘์„ ํ•œ ๋ฌธ์žฅ์œผ๋กœ ์‹œ์ž‘
457
- - ๊ตฌ์ฒด์ ์ธ ๋™์ž‘๊ณผ ์ œ์Šค์ฒ˜ ์ถ”๊ฐ€
458
- - ์บ๋ฆญํ„ฐ/๊ฐ์ฒด์˜ ์™ธ๋ชจ๋ฅผ ์ •ํ™•ํžˆ ์„ค๋ช…
459
- - ๋ฐฐ๊ฒฝ๊ณผ ํ™˜๊ฒฝ ์„ธ๋ถ€ ์‚ฌํ•ญ ํฌํ•จ
460
- - ์นด๋ฉ”๋ผ ๊ฐ๋„์™€ ์›€์ง์ž„ ์ง€์ •
461
- - ์กฐ๋ช…๊ณผ ์ƒ‰์ƒ ์„ค๋ช…
462
- - ๋ณ€ํ™”๋‚˜ ๊ฐ‘์ž‘์Šค๋Ÿฌ์šด ์‚ฌ๊ฑด ๊ธฐ๋ก
463
-
464
- ์˜ˆ์‹œ๋ฅผ ์ฐธ๊ณ ํ•˜์„ธ์š”.
465
-
466
- ๐ŸŽฎ ๋งค๊ฐœ๋ณ€์ˆ˜ ๊ฐ€์ด๋“œ
467
-
468
- - ํ•ด์ƒ๋„ ํ”„๋ฆฌ์…‹: ์ƒ์„ธํ•œ ์žฅ๋ฉด์€ ๋†’์€ ํ•ด์ƒ๋„, ๋‹จ์ˆœํ•œ ์žฅ๋ฉด์€ ๋‚ฎ์€ ํ•ด์ƒ๋„ ์„ ํƒ
469
- - Seed: ํŠน์ • ์Šคํƒ€์ผ์ด๋‚˜ ๊ตฌ์„ฑ์„ ์žฌํ˜„ํ•˜๊ณ  ์‹ถ์„ ๋•Œ seed ๊ฐ’ ์ €์žฅ
470
- - Guidance Scale: 3-3.5๊ฐ€ ๊ถŒ์žฅ๊ฐ’
471
- - Inference Steps: ํ’ˆ์งˆ์„ ์œ„ํ•ด์„œ๋Š” 40+ ๋‹จ๊ณ„, ์†๋„๋ฅผ ์œ„ํ•ด์„œ๋Š” 20-30 ๋‹จ๊ณ„
472
- """
473
- )
474
 
475
  with gr.Tabs():
476
  # Text to Video Tab
 
120
 
121
  def enhance_prompt_if_enabled(prompt, enhance_toggle, type="t2v"):
122
  if not enhance_toggle:
123
+ print("Enhance toggle is off, Original Prompt: ", prompt)
124
  return prompt
125
 
126
  system_prompt = system_prompt_t2v if type == "t2v" else system_prompt_i2v
 
135
  messages=messages,
136
  max_tokens=200,
137
  )
138
+ enhanced_prompt = response.choices[0].message.content.strip()
139
+
140
+ print("\n=== ํ”„๋กฌํ”„ํŠธ ์ฆ๊ฐ• ๊ฒฐ๊ณผ ===")
141
+ print("Original Prompt:")
142
+ print(prompt)
143
+ print("\nEnhanced Prompt:")
144
+ print(enhanced_prompt)
145
+ print("========================\n")
146
+
147
+ return enhanced_prompt
148
  except Exception as e:
149
+ print(f"Error during prompt enhancement: {e}")
150
  return prompt
151
 
152
  # Preset options for resolution and frame configuration
 
450
  with gr.Blocks(theme=gr.themes.Soft()) as iface:
451
 
452
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
 
454
  with gr.Tabs():
455
  # Text to Video Tab