Spaces:
Runtime error
Runtime error
Try via html object?
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import os
|
|
5 |
from huggingface_hub import hf_hub_download
|
6 |
import time
|
7 |
from pathlib import Path
|
|
|
8 |
|
9 |
PORT = 7860
|
10 |
HOST = "0.0.0.0"
|
@@ -24,14 +25,11 @@ def run_aim():
|
|
24 |
subprocess.run(["unzip", "test.zip"])
|
25 |
subprocess.run(["mv", "test/.aim/", "/home/user/app/.aim/"])
|
26 |
time.sleep(5)
|
27 |
-
cmd = f"aim up --host {HOST} --port {PORT} --dev"
|
28 |
subprocess.run(cmd, shell=True)
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
<iframe
|
33 |
-
src="http://localhost:{PORT}"
|
34 |
-
style=""
|
35 |
position: fixed;
|
36 |
top: 0px;
|
37 |
bottom: 0px;
|
@@ -43,11 +41,25 @@ html = f"""
|
|
43 |
overflow: hidden;
|
44 |
z-index: 999999;
|
45 |
height: 100%;
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
</iframe>
|
47 |
"""
|
48 |
|
49 |
def main():
|
50 |
run_aim()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
if __name__ == "__main__":
|
53 |
main()
|
|
|
5 |
from huggingface_hub import hf_hub_download
|
6 |
import time
|
7 |
from pathlib import Path
|
8 |
+
import gradio as gr
|
9 |
|
10 |
PORT = 7860
|
11 |
HOST = "0.0.0.0"
|
|
|
25 |
subprocess.run(["unzip", "test.zip"])
|
26 |
subprocess.run(["mv", "test/.aim/", "/home/user/app/.aim/"])
|
27 |
time.sleep(5)
|
28 |
+
cmd = f"aim up --host {HOST} --port {PORT} --dev --base-path /proxy/absolute/{port} &"
|
29 |
subprocess.run(cmd, shell=True)
|
30 |
|
31 |
+
"""
|
32 |
+
style "";
|
|
|
|
|
|
|
33 |
position: fixed;
|
34 |
top: 0px;
|
35 |
bottom: 0px;
|
|
|
41 |
overflow: hidden;
|
42 |
z-index: 999999;
|
43 |
height: 100%;
|
44 |
+
"""
|
45 |
+
|
46 |
+
html = f"""
|
47 |
+
<iframe
|
48 |
+
src="http://{HOST}:{PORT}/proxy/absolute/{port}"
|
49 |
+
>
|
50 |
</iframe>
|
51 |
"""
|
52 |
|
53 |
def main():
|
54 |
run_aim()
|
55 |
+
demo = gr.Interface(
|
56 |
+
fn=run,
|
57 |
+
inputs=[],
|
58 |
+
outputs=gr.HTML(html),
|
59 |
+
)
|
60 |
+
|
61 |
+
demo.launch()
|
62 |
+
|
63 |
|
64 |
if __name__ == "__main__":
|
65 |
main()
|