Return URLs directly instead of downloading files
Browse filesGradio on HF Spaces can't serve files from temp directories.
Since images/videos are hosted on IPFS, return URLs directly.
- src/ui/handlers.py +8 -16
src/ui/handlers.py
CHANGED
|
@@ -210,10 +210,8 @@ class Handlers:
|
|
| 210 |
)
|
| 211 |
|
| 212 |
if images:
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
)
|
| 216 |
-
return image_path, "Image generated successfully!"
|
| 217 |
else:
|
| 218 |
return None, "No image was generated. Please try a different prompt."
|
| 219 |
|
|
@@ -260,10 +258,8 @@ class Handlers:
|
|
| 260 |
)
|
| 261 |
|
| 262 |
if images:
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
)
|
| 266 |
-
return image_path, "Image edited successfully!"
|
| 267 |
else:
|
| 268 |
return None, "No edited image was generated. Please try again."
|
| 269 |
|
|
@@ -306,10 +302,8 @@ class Handlers:
|
|
| 306 |
)
|
| 307 |
|
| 308 |
if videos:
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
)
|
| 312 |
-
return video_path, "Video generated successfully!"
|
| 313 |
else:
|
| 314 |
return None, "No video was generated. Please try a different prompt."
|
| 315 |
|
|
@@ -356,10 +350,8 @@ class Handlers:
|
|
| 356 |
)
|
| 357 |
|
| 358 |
if videos:
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
)
|
| 362 |
-
return video_path, "Image animated successfully!"
|
| 363 |
else:
|
| 364 |
return None, "No video was generated. Please try again."
|
| 365 |
|
|
|
|
| 210 |
)
|
| 211 |
|
| 212 |
if images:
|
| 213 |
+
# Return URL directly - Gradio can display remote images
|
| 214 |
+
return images[0].image_url, "Image generated successfully!"
|
|
|
|
|
|
|
| 215 |
else:
|
| 216 |
return None, "No image was generated. Please try a different prompt."
|
| 217 |
|
|
|
|
| 258 |
)
|
| 259 |
|
| 260 |
if images:
|
| 261 |
+
# Return URL directly - Gradio can display remote images
|
| 262 |
+
return images[0].image_url, "Image edited successfully!"
|
|
|
|
|
|
|
| 263 |
else:
|
| 264 |
return None, "No edited image was generated. Please try again."
|
| 265 |
|
|
|
|
| 302 |
)
|
| 303 |
|
| 304 |
if videos:
|
| 305 |
+
# Return URL directly - Gradio can display remote videos
|
| 306 |
+
return videos[0].video_url, "Video generated successfully!"
|
|
|
|
|
|
|
| 307 |
else:
|
| 308 |
return None, "No video was generated. Please try a different prompt."
|
| 309 |
|
|
|
|
| 350 |
)
|
| 351 |
|
| 352 |
if videos:
|
| 353 |
+
# Return URL directly - Gradio can display remote videos
|
| 354 |
+
return videos[0].video_url, "Image animated successfully!"
|
|
|
|
|
|
|
| 355 |
else:
|
| 356 |
return None, "No video was generated. Please try again."
|
| 357 |
|