chingshuai
commited on
Commit
·
486bb14
1
Parent(s):
559793a
fix bug of rewrite
Browse files- gradio_app.py +6 -7
gradio_app.py
CHANGED
|
@@ -235,15 +235,14 @@ def generate_motion_func(
|
|
| 235 |
) -> Tuple[str, List[str]]:
|
| 236 |
use_prompt_engineering = USE_PROMPT_ENGINEERING
|
| 237 |
output_dir = "output/gradio"
|
| 238 |
-
#
|
| 239 |
-
if use_prompt_engineering:
|
| 240 |
text_to_use = rewritten_text.strip()
|
| 241 |
-
|
| 242 |
-
return "Error: Rewritten text is empty, please rewrite the text first", []
|
| 243 |
-
else:
|
| 244 |
text_to_use = original_text.strip()
|
| 245 |
-
|
| 246 |
-
|
|
|
|
| 247 |
|
| 248 |
try:
|
| 249 |
# Use runtime from global if available (for Zero GPU), otherwise use self.runtime
|
|
|
|
| 235 |
) -> Tuple[str, List[str]]:
|
| 236 |
use_prompt_engineering = USE_PROMPT_ENGINEERING
|
| 237 |
output_dir = "output/gradio"
|
| 238 |
+
# Determine which text to use: prefer rewritten_text, fallback to original_text
|
| 239 |
+
if use_prompt_engineering and rewritten_text.strip():
|
| 240 |
text_to_use = rewritten_text.strip()
|
| 241 |
+
elif original_text.strip():
|
|
|
|
|
|
|
| 242 |
text_to_use = original_text.strip()
|
| 243 |
+
else:
|
| 244 |
+
# Both are empty
|
| 245 |
+
return "Error: Input text is empty, please enter text first", []
|
| 246 |
|
| 247 |
try:
|
| 248 |
# Use runtime from global if available (for Zero GPU), otherwise use self.runtime
|