Spaces:
Running
on
Zero
Running
on
Zero
fixed path?
Browse files
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 =
|
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=
|
42 |
-
link = f'<a href="/file=
|
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 |
|