Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|