naman1102 commited on
Commit
2c6be25
·
1 Parent(s): 8e909cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -379,10 +379,11 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
379
  try:
380
  print(f"\nProcessing question {task_id}...")
381
 
382
- # Use the URL that is already present
383
- raw_url = item.get("file_url", "")
384
- # It may be relative ("/file/abc.mp3"), so prepend the host when needed
385
- file_url = f"{api_url}{raw_url}" if raw_url.startswith("/") else raw_url
 
386
 
387
  answer = agent(
388
  question=item.get("question", ""),
 
379
  try:
380
  print(f"\nProcessing question {task_id}...")
381
 
382
+ # Handle file URL with fallback to generic attachment endpoint
383
+ raw_url = item.get("file_url") or ""
384
+ if not raw_url: # fallback for empty field
385
+ raw_url = f"/files/{task_id}" # generic attachment endpoint
386
+ file_url = f"{api_url}{raw_url}" # absolute URL
387
 
388
  answer = agent(
389
  question=item.get("question", ""),