ammariii08 commited on
Commit
a2c7195
·
verified ·
1 Parent(s): 3730760

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -13
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
- dl_link = to_direct_download(out["drive_link"]) or out["drive_link"]
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
- **Drive Link:**
70
- `{dl_link}`
71
-
72
- **Job ID:** `{job_id}`
73
- **Status:** `{status}`
 
 
 
 
 
 
 
 
 
74
 
75
- **Submission Delay:** `{delay:.1f}s`
76
- **Execution Time:** `{exec_time:.1f}s`
77
- """
78
 
79
- # Render a styled HTML link inside Markdown
80
- button_md = f'<a href="{dl_link}" target="_blank" style="display:inline-block;padding:8px 16px;background:#4CAF50;color:white;border-radius:4px;text-decoration:none;">Open Download</a>'
81
 
82
- return "✅ Completed!", dl_link, details_md, button_md
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: