Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,7 +53,7 @@ def process_video(drive_link, progress=gr.Progress()):
|
|
| 53 |
t2 = time.time()
|
| 54 |
exec_time = t2 - t1
|
| 55 |
out = st["output"]
|
| 56 |
-
|
| 57 |
break
|
| 58 |
if status == "FAILED":
|
| 59 |
progress(1.0, desc="Job Failed")
|
|
@@ -65,21 +65,28 @@ def process_video(drive_link, progress=gr.Progress()):
|
|
| 65 |
progress(1.0, desc="Completed")
|
| 66 |
delay = t1 - t0
|
| 67 |
|
| 68 |
-
details_md = f""
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
-
|
| 76 |
-
**Execution Time:** `{exec_time:.1f}s`
|
| 77 |
-
"""
|
| 78 |
|
| 79 |
-
#
|
| 80 |
-
|
| 81 |
|
| 82 |
-
return "✅ Completed!",
|
| 83 |
|
| 84 |
def create_ui():
|
| 85 |
with gr.Blocks(theme=gr.themes.Soft()) as app:
|
|
|
|
| 53 |
t2 = time.time()
|
| 54 |
exec_time = t2 - t1
|
| 55 |
out = st["output"]
|
| 56 |
+
drive_links = out.get("drive_links", [])
|
| 57 |
break
|
| 58 |
if status == "FAILED":
|
| 59 |
progress(1.0, desc="Job Failed")
|
|
|
|
| 65 |
progress(1.0, desc="Completed")
|
| 66 |
delay = t1 - t0
|
| 67 |
|
| 68 |
+
details_md = f"**Job ID:** `{job_id}` \n**Status:** `{status}`\n\n**Submission Delay:** `{delay:.1f}s` \n**Execution Time:** `{exec_time:.1f}s`\n\n"
|
| 69 |
+
|
| 70 |
+
# Compose all download links, one per drive
|
| 71 |
+
links_md = ""
|
| 72 |
+
button_md = ""
|
| 73 |
+
for item in drive_links:
|
| 74 |
+
drive = item.get("drive", "Unknown")
|
| 75 |
+
web_link = item.get("webViewLink", "")
|
| 76 |
+
dl_link = to_direct_download(web_link) or web_link
|
| 77 |
+
links_md += f"**{drive} Drive Link:** \n`{web_link}`\n\n"
|
| 78 |
+
# Add download button per drive
|
| 79 |
+
button_md += (
|
| 80 |
+
f'<a href="{web_link}" target="_blank" style="display:inline-block;padding:8px 16px;background:#4CAF50;color:white;border-radius:4px;text-decoration:none;margin-right:8px;">'
|
| 81 |
+
f'Open {drive} Download</a> '
|
| 82 |
+
)
|
| 83 |
|
| 84 |
+
details_md = links_md + details_md
|
|
|
|
|
|
|
| 85 |
|
| 86 |
+
# Optionally, show first link as the main download link
|
| 87 |
+
primary_dl_link = drive_links[0]["webViewLink"] if drive_links else ""
|
| 88 |
|
| 89 |
+
return "✅ Completed!", primary_dl_link, details_md, button_md
|
| 90 |
|
| 91 |
def create_ui():
|
| 92 |
with gr.Blocks(theme=gr.themes.Soft()) as app:
|