Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -458,13 +458,25 @@ def create_demo():
|
|
| 458 |
|
| 459 |
def worker(url: str, prompt: str, key: str, progress=gr.Progress()):
|
| 460 |
try:
|
| 461 |
-
if not url:
|
|
|
|
|
|
|
| 462 |
src = url
|
| 463 |
progress(0, desc="Starting processing...")
|
| 464 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
|
| 466 |
-
if hasattr(result, "result"):
|
|
|
|
|
|
|
| 467 |
return result if result else "Error: no result returned."
|
|
|
|
| 468 |
except Exception as e:
|
| 469 |
return f"Unexpected error in worker: {e}"
|
| 470 |
|
|
|
|
| 458 |
|
| 459 |
def worker(url: str, prompt: str, key: str, progress=gr.Progress()):
|
| 460 |
try:
|
| 461 |
+
if not url:
|
| 462 |
+
raise ValueError("No URL provided.")
|
| 463 |
+
|
| 464 |
src = url
|
| 465 |
progress(0, desc="Starting processing...")
|
| 466 |
+
|
| 467 |
+
result = run_blocking_in_thread(
|
| 468 |
+
process_media,
|
| 469 |
+
src,
|
| 470 |
+
prompt or "",
|
| 471 |
+
key or "",
|
| 472 |
+
progress
|
| 473 |
+
)
|
| 474 |
|
| 475 |
+
if hasattr(result, "result"):
|
| 476 |
+
result = result.result()
|
| 477 |
+
|
| 478 |
return result if result else "Error: no result returned."
|
| 479 |
+
|
| 480 |
except Exception as e:
|
| 481 |
return f"Unexpected error in worker: {e}"
|
| 482 |
|