m7n commited on
Commit
4328f9b
·
1 Parent(s): a7f48bd

fixed path?

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -19,7 +19,7 @@ print("os.environ['GRADIO_ALLOWED_PATHS'] = ",os.environ["GRADIO_ALLOWED_PATHS"]
19
  def predict(request: gr.Request,text_input):
20
  token = _get_token(request)
21
  file_name = f"{datetime.utcnow().strftime('%s')}.html"
22
- file_path = static_dir / file_name
23
  print(file_path)
24
  with open(file_path, "w") as f:
25
  f.write(f"""
@@ -36,10 +36,10 @@ def predict(request: gr.Request,text_input):
36
  </body>
37
  </html>
38
  """)
39
- file_path = static_dir / file_name
40
  os.chmod(file_path, 0o644)
41
- iframe = f'<iframe src="/file=static/{file_name}" width="100%" height="500px"></iframe>'
42
- link = f'<a href="/file=static/{file_name}" target="_blank">{file_name}</a>'
43
  print("Serving file at:", f"/file={file_path}")
44
  return link, iframe
45
 
 
19
  def predict(request: gr.Request,text_input):
20
  token = _get_token(request)
21
  file_name = f"{datetime.utcnow().strftime('%s')}.html"
22
+ file_path = "/home/user/app/static/" + file_name
23
  print(file_path)
24
  with open(file_path, "w") as f:
25
  f.write(f"""
 
36
  </body>
37
  </html>
38
  """)
39
+ # file_path = static_dir / file_name
40
  os.chmod(file_path, 0o644)
41
+ iframe = f'<iframe src="/file={file_name}" width="100%" height="500px"></iframe>'
42
+ link = f'<a href="/file={file_name}" target="_blank">{file_name}</a>'
43
  print("Serving file at:", f"/file={file_path}")
44
  return link, iframe
45