m7n commited on
Commit
6eed02d
·
1 Parent(s): 387f245

Update static file serving route in app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -43,10 +43,10 @@ def predict(request: gr.Request, text_input):
43
  </html>
44
  """)
45
  os.chmod(file_path, 0o644)
46
- # Construct the URL using the repository-relative path.
47
- iframe = f'<iframe src="/file=static/{file_name}" width="100%" height="500px"></iframe>'
48
- link = f'<a href="/file=static/{file_name}" target="_blank">{file_name}</a>'
49
- print("Serving file at URL:", f"/file=static/{file_name}")
50
  return link, iframe
51
 
52
  with gr.Blocks() as block:
 
43
  </html>
44
  """)
45
  os.chmod(file_path, 0o644)
46
+ # Use the direct static route instead of Gradio's file route
47
+ iframe = f'<iframe src="/static/{file_name}" width="100%" height="500px"></iframe>'
48
+ link = f'<a href="/static/{file_name}" target="_blank">{file_name}</a>'
49
+ print("Serving file at URL:", f"/static/{file_name}")
50
  return link, iframe
51
 
52
  with gr.Blocks() as block: