Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,46 +1,29 @@
|
|
1 |
import os
|
2 |
import subprocess
|
3 |
import threading
|
4 |
-
import json
|
5 |
import gradio as gr
|
6 |
|
7 |
def install_pufferpanel():
|
8 |
-
if not os.path.exists("pufferpanel"):
|
9 |
-
# Download
|
10 |
subprocess.run(
|
11 |
-
"wget https://github.com/pufferpanel/pufferpanel/
|
12 |
shell=True, check=True
|
13 |
)
|
14 |
-
|
15 |
-
subprocess.run("
|
16 |
-
|
17 |
-
|
18 |
-
os.chdir("pufferpanel-3.0.0-rc.14")
|
19 |
-
subprocess.run("go build -o ../pufferpanel ./cmd", shell=True, check=True)
|
20 |
-
os.chdir("..")
|
21 |
-
|
22 |
-
# Create config.json
|
23 |
-
config = {
|
24 |
-
"web": {"listen": "0.0.0.0:8080"},
|
25 |
-
"daemon": {"listen": "0.0.0.0:5657"},
|
26 |
-
"security": {"disableUnshare": True}
|
27 |
-
}
|
28 |
-
with open("config.json", "w") as f:
|
29 |
-
json.dump(config, f, indent=4)
|
30 |
-
|
31 |
-
# Initialize admin user
|
32 |
-
subprocess.run("./pufferpanel install --user admin --password admin123", shell=True, check=True)
|
33 |
-
|
34 |
-
install_pufferpanel()
|
35 |
|
36 |
def run_pufferpanel():
|
37 |
-
subprocess.run("
|
38 |
|
|
|
39 |
threading.Thread(target=run_pufferpanel, daemon=True).start()
|
40 |
|
41 |
def launch_info():
|
42 |
return """
|
43 |
-
## π PufferPanel v3.0.0-rc.14
|
44 |
|
45 |
Running inside Hugging Face Space.
|
46 |
|
@@ -48,7 +31,6 @@ Running inside Hugging Face Space.
|
|
48 |
- **User:** `admin`
|
49 |
- **Pass:** `admin123`
|
50 |
|
51 |
-
Use the embedded panel below:
|
52 |
"""
|
53 |
|
54 |
with gr.Blocks(title="PufferPanel on Hugging Face") as demo:
|
@@ -60,4 +42,4 @@ with gr.Blocks(title="PufferPanel on Hugging Face") as demo:
|
|
60 |
""")
|
61 |
|
62 |
if __name__ == "__main__":
|
63 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
1 |
import os
|
2 |
import subprocess
|
3 |
import threading
|
|
|
4 |
import gradio as gr
|
5 |
|
6 |
def install_pufferpanel():
|
7 |
+
if not os.path.exists("/usr/sbin/pufferpanel"):
|
8 |
+
# Download amd64 deb package
|
9 |
subprocess.run(
|
10 |
+
"wget https://github.com/pufferpanel/pufferpanel/releases/download/v3.0.0-rc.14/pufferpanel_3.0.0-rc.14_amd64.deb -O pufferpanel.deb",
|
11 |
shell=True, check=True
|
12 |
)
|
13 |
+
# Install dependencies and package
|
14 |
+
subprocess.run("apt-get update && apt-get install -y ./pufferpanel.deb", shell=True, check=True)
|
15 |
+
# Enable PufferPanel
|
16 |
+
subprocess.run("pufferpanel user add admin --password admin123", shell=True, check=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
def run_pufferpanel():
|
19 |
+
subprocess.run("pufferpanel run", shell=True)
|
20 |
|
21 |
+
install_pufferpanel()
|
22 |
threading.Thread(target=run_pufferpanel, daemon=True).start()
|
23 |
|
24 |
def launch_info():
|
25 |
return """
|
26 |
+
## π PufferPanel v3.0.0-rc.14
|
27 |
|
28 |
Running inside Hugging Face Space.
|
29 |
|
|
|
31 |
- **User:** `admin`
|
32 |
- **Pass:** `admin123`
|
33 |
|
|
|
34 |
"""
|
35 |
|
36 |
with gr.Blocks(title="PufferPanel on Hugging Face") as demo:
|
|
|
42 |
""")
|
43 |
|
44 |
if __name__ == "__main__":
|
45 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|