m7n commited on
Commit
447fa92
·
1 Parent(s): 08be7e7

added chmod

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -2,7 +2,7 @@ from pathlib import Path
2
  import gradio as gr
3
  from datetime import datetime
4
  import sys
5
-
6
 
7
  import spaces # necessary to run on Zero.
8
  from spaces.zero.client import _get_token
@@ -33,9 +33,11 @@ def predict(request: gr.Request,text_input):
33
  </body>
34
  </html>
35
  """)
36
- iframe = f'<iframe src="/file=static/{file_name}" width="100%" height="500px"></iframe>'
37
- link = f'<a href="/file=static/{file_name}" target="_blank">{file_name}</a>'
38
- print("Serving file at:", f"/file=static/{file_name}")
 
 
39
  return link, iframe
40
 
41
  with gr.Blocks() as block:
 
2
  import gradio as gr
3
  from datetime import datetime
4
  import sys
5
+ import os
6
 
7
  import spaces # necessary to run on Zero.
8
  from spaces.zero.client import _get_token
 
33
  </body>
34
  </html>
35
  """)
36
+ file_path = static_dir / file_name
37
+ os.chmod(file_path, 0o644)
38
+ iframe = f'<iframe src="/file={file_path}" width="100%" height="500px"></iframe>'
39
+ link = f'<a href="/file={file_path}" target="_blank">{file_name}</a>'
40
+ print("Serving file at:", f"/file={file_path}")
41
  return link, iframe
42
 
43
  with gr.Blocks() as block: