naman1102 commited on
Commit
d377007
·
1 Parent(s): a1148b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -341,7 +341,6 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
341
  api_url = DEFAULT_API_URL
342
  questions_url = f"{api_url}/questions"
343
  submit_url = f"{api_url}/submit"
344
- file_base_url = f"{api_url}/file" # Base URL for file downloads
345
 
346
  # 1. Instantiate Agent
347
  try:
@@ -378,11 +377,11 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
378
  try:
379
  print(f"\nProcessing question {task_id}...")
380
 
381
- # Build file URL if file_name is present
382
- file_name = item.get("file_name", "")
383
- file_url = f"{file_base_url}/{file_name}" if file_name else ""
 
384
 
385
- # Call agent with question, task_id, and file_url
386
  answer = agent(
387
  question=item.get("question", ""),
388
  task_id=task_id,
 
341
  api_url = DEFAULT_API_URL
342
  questions_url = f"{api_url}/questions"
343
  submit_url = f"{api_url}/submit"
 
344
 
345
  # 1. Instantiate Agent
346
  try:
 
377
  try:
378
  print(f"\nProcessing question {task_id}...")
379
 
380
+ # Use the URL that is already present
381
+ raw_url = item.get("file_url", "")
382
+ # It may be relative ("/file/abc.mp3"), so prepend the host when needed
383
+ file_url = f"{api_url}{raw_url}" if raw_url.startswith("/") else raw_url
384
 
 
385
  answer = agent(
386
  question=item.get("question", ""),
387
  task_id=task_id,