Spaces:
Sleeping
Sleeping
added chmod
Browse files
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 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
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:
|