Techbitforge commited on
Commit
dc9f2d1
·
verified ·
1 Parent(s): 890f0bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -6,23 +6,29 @@ 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()
@@ -34,7 +40,7 @@ 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
 
@@ -54,4 +60,4 @@ with gr.Blocks(title="PufferPanel on Hugging Face") as demo:
54
  """)
55
 
56
  if __name__ == "__main__":
57
- demo.launch(server_name="0.0.0.0", server_port=7860)
 
6
 
7
  def install_pufferpanel():
8
  if not os.path.exists("pufferpanel"):
9
+ # Download source code
10
  subprocess.run(
11
+ "wget https://github.com/pufferpanel/pufferpanel/archive/refs/tags/v3.0.0-rc.14.tar.gz -O puffer-src.tar.gz",
12
  shell=True, check=True
13
  )
14
+ subprocess.run("tar -xzf puffer-src.tar.gz", shell=True, check=True)
15
+ subprocess.run("rm puffer-src.tar.gz", shell=True, check=True)
16
 
17
+ # Enter source dir and build
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()
 
40
 
41
  def launch_info():
42
  return """
43
+ ## 🚀 PufferPanel v3.0.0-rc.14 (Built from Source)
44
 
45
  Running inside Hugging Face Space.
46
 
 
60
  """)
61
 
62
  if __name__ == "__main__":
63
+ demo.launch(server_name="0.0.0.0", server_port=7860)