Spaces:
Runtime error
Runtime error
import os | |
import subprocess | |
import threading | |
import json | |
import gradio as gr | |
def install_pufferpanel(): | |
if not os.path.exists("pufferpanel"): | |
# Download a valid binary for v3.0.0-rc.13 | |
subprocess.run( | |
"wget https://github.com/PufferPanel/PufferPanel/releases/download/v3.0.0-rc.13/pufferpanel-linux-amd64.tar.gz -O puffer.tar.gz", | |
shell=True, check=True | |
) | |
subprocess.run("tar -xzf puffer.tar.gz -C .", shell=True, check=True) | |
subprocess.run("rm puffer.tar.gz", shell=True, check=True) | |
config = { | |
"web": {"listen": "0.0.0.0:8080"}, | |
"daemon": {"listen": "0.0.0.0:5657"}, | |
# If needed, disable advanced sandboxing | |
"security": {"disableUnshare": True} | |
} | |
with open("config.json", "w") as f: | |
json.dump(config, f, indent=4) | |
subprocess.run("./pufferpanel install --user admin --password admin123", shell=True, check=True) | |
install_pufferpanel() | |
def run_pufferpanel(): | |
subprocess.run("./pufferpanel run", shell=True) | |
threading.Thread(target=run_pufferpanel, daemon=True).start() | |
def launch_info(): | |
return """ | |
## PufferPanel v3.0.0-rc.13 | |
Running inside Hugging Face Space. | |
**Login Credentials:** | |
- **User:** `admin` | |
- **Pass:** `admin123` | |
Use the embedded panel below: | |
""" | |
with gr.Blocks(title="PufferPanel on Hugging Face") as demo: | |
gr.Markdown(launch_info) | |
gr.HTML(""" | |
<iframe src="http://localhost:8080" | |
style="width:100%; height:800px; border:none;"> | |
</iframe> | |
""") | |
if __name__ == "__main__": | |
demo.launch(server_name="0.0.0.0", server_port=7860) | |