Update app.py
Browse files
app.py
CHANGED
|
@@ -81,13 +81,16 @@ def infer(text):
|
|
| 81 |
return "Error in motion generation."
|
| 82 |
|
| 83 |
try:
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
| 91 |
except Exception as e:
|
| 92 |
print(f"Error generating GIF: {str(e)}")
|
| 93 |
return "Error generating GIF. Please try again."
|
|
@@ -105,5 +108,6 @@ with gr.Blocks(css=".container { max-width: 800px; margin: auto; }") as demo:
|
|
| 105 |
outputs=[output_image]
|
| 106 |
)
|
| 107 |
|
|
|
|
| 108 |
if __name__ == "__main__":
|
| 109 |
demo.launch()
|
|
|
|
| 81 |
return "Error in motion generation."
|
| 82 |
|
| 83 |
try:
|
| 84 |
+
gif_data = draw_to_batch([motion_data], [text], None)
|
| 85 |
+
if gif_data:
|
| 86 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=".gif") as temp_file:
|
| 87 |
+
temp_file.write(gif_data)
|
| 88 |
+
temp_file_path = temp_file.name
|
| 89 |
+
print("GIF successfully saved to temporary file.")
|
| 90 |
+
return temp_file_path
|
| 91 |
+
else:
|
| 92 |
+
print("Failed to generate GIF data.")
|
| 93 |
+
return "Error generating GIF. Please try again."
|
| 94 |
except Exception as e:
|
| 95 |
print(f"Error generating GIF: {str(e)}")
|
| 96 |
return "Error generating GIF. Please try again."
|
|
|
|
| 108 |
outputs=[output_image]
|
| 109 |
)
|
| 110 |
|
| 111 |
+
|
| 112 |
if __name__ == "__main__":
|
| 113 |
demo.launch()
|