Techbitforge commited on
Commit
fd9d9e6
·
verified ·
1 Parent(s): a6e80fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -25
app.py CHANGED
@@ -4,65 +4,54 @@ import threading
4
  import json
5
  import gradio as gr
6
 
7
- # ================================
8
- # Install & Configure PufferPanel
9
- # ================================
10
  def install_pufferpanel():
11
  if not os.path.exists("pufferpanel"):
12
- # Download PufferPanel v2.7.1 (latest stable release)
13
  subprocess.run(
14
- "wget https://github.com/PufferPanel/PufferPanel/releases/download/v2.7.1/pufferpanel-linux-amd64.tar.gz -O puffer.tar.gz",
15
  shell=True, check=True
16
  )
17
  subprocess.run("tar -xzf puffer.tar.gz -C .", shell=True, check=True)
18
  subprocess.run("rm puffer.tar.gz", shell=True, check=True)
19
 
20
- # Configure PufferPanel to run on port 8080
21
  config = {
22
  "web": {"listen": "0.0.0.0:8080"},
23
- "daemon": {"listen": "0.0.0.0:5657"}
 
 
24
  }
25
  with open("config.json", "w") as f:
26
  json.dump(config, f, indent=4)
27
 
28
- # Initialize admin user
29
  subprocess.run("./pufferpanel install --user admin --password admin123", shell=True, check=True)
30
 
31
- # ================================
32
- # Run PufferPanel in background
33
- # ================================
34
  def run_pufferpanel():
35
  subprocess.run("./pufferpanel run", shell=True)
36
 
37
- # Ensure installation
38
- install_pufferpanel()
39
-
40
- # Start PufferPanel in background thread
41
  threading.Thread(target=run_pufferpanel, daemon=True).start()
42
 
43
- # ================================
44
- # Gradio Wrapper App
45
- # ================================
46
  def launch_info():
47
  return """
48
- # ✅ PufferPanel is running inside Hugging Face
49
 
50
- Use the embedded panel below.
51
 
52
  **Login Credentials:**
53
  - **User:** `admin`
54
  - **Pass:** `admin123`
 
 
55
  """
56
 
57
  with gr.Blocks(title="PufferPanel on Hugging Face") as demo:
58
  gr.Markdown(launch_info)
59
- gr.HTML(
60
- """
61
  <iframe src="http://localhost:8080"
62
  style="width:100%; height:800px; border:none;">
63
  </iframe>
64
- """
65
- )
66
 
67
  if __name__ == "__main__":
68
- demo.launch(server_name="0.0.0.0", server_port=7860)
 
4
  import json
5
  import gradio as gr
6
 
 
 
 
7
  def install_pufferpanel():
8
  if not os.path.exists("pufferpanel"):
9
+ # Download a valid binary for v3.0.0-rc.13
10
  subprocess.run(
11
+ "wget https://github.com/PufferPanel/PufferPanel/releases/download/v3.0.0-rc.13/pufferpanel-linux-amd64.tar.gz -O puffer.tar.gz",
12
  shell=True, check=True
13
  )
14
  subprocess.run("tar -xzf puffer.tar.gz -C .", shell=True, check=True)
15
  subprocess.run("rm puffer.tar.gz", shell=True, check=True)
16
 
 
17
  config = {
18
  "web": {"listen": "0.0.0.0:8080"},
19
+ "daemon": {"listen": "0.0.0.0:5657"},
20
+ # If needed, disable advanced sandboxing
21
+ "security": {"disableUnshare": True}
22
  }
23
  with open("config.json", "w") as f:
24
  json.dump(config, f, indent=4)
25
 
 
26
  subprocess.run("./pufferpanel install --user admin --password admin123", shell=True, check=True)
27
 
28
+ install_pufferpanel()
29
+
 
30
  def run_pufferpanel():
31
  subprocess.run("./pufferpanel run", shell=True)
32
 
 
 
 
 
33
  threading.Thread(target=run_pufferpanel, daemon=True).start()
34
 
 
 
 
35
  def launch_info():
36
  return """
37
+ ## PufferPanel v3.0.0-rc.13
38
 
39
+ Running inside Hugging Face Space.
40
 
41
  **Login Credentials:**
42
  - **User:** `admin`
43
  - **Pass:** `admin123`
44
+
45
+ Use the embedded panel below:
46
  """
47
 
48
  with gr.Blocks(title="PufferPanel on Hugging Face") as demo:
49
  gr.Markdown(launch_info)
50
+ gr.HTML("""
 
51
  <iframe src="http://localhost:8080"
52
  style="width:100%; height:800px; border:none;">
53
  </iframe>
54
+ """)
 
55
 
56
  if __name__ == "__main__":
57
+ demo.launch(server_name="0.0.0.0", server_port=7860)