pakdeveloper commited on
Commit
ada725d
·
verified ·
1 Parent(s): 9f2ddb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -6
app.py CHANGED
@@ -9,14 +9,14 @@ os.chdir("Fooocus-main")
9
  # Install dependencies
10
  os.system("pip install pygit2==1.15.1")
11
 
12
- # Function to start Fooocus server
13
  def start_fooocus():
14
- # Run Fooocus in the background
15
  subprocess.Popen(["python", "entry_with_update.py", "--always-cpu", "--port", "7860"])
16
  time.sleep(10) # Wait for the server to start
17
- return "Fooocus AI is running! Visit the app below."
18
 
19
- # Gradio interface to embed Fooocus
20
  iface = gr.Interface(
21
  fn=start_fooocus,
22
  inputs=None,
@@ -26,5 +26,15 @@ iface = gr.Interface(
26
  description="Fooocus AI is running directly in this Space."
27
  )
28
 
29
- # Launch Gradio app
30
- iface.launch(server_name="0.0.0.0", server_port=7860)
 
 
 
 
 
 
 
 
 
 
 
9
  # Install dependencies
10
  os.system("pip install pygit2==1.15.1")
11
 
12
+ # Start Fooocus server in the background
13
  def start_fooocus():
14
+ # Run Fooocus server
15
  subprocess.Popen(["python", "entry_with_update.py", "--always-cpu", "--port", "7860"])
16
  time.sleep(10) # Wait for the server to start
17
+ return "Fooocus AI is running! Use the app below."
18
 
19
+ # Gradio interface to embed Fooocus UI
20
  iface = gr.Interface(
21
  fn=start_fooocus,
22
  inputs=None,
 
26
  description="Fooocus AI is running directly in this Space."
27
  )
28
 
29
+ # Embed Fooocus UI in an iframe
30
+ iface.launch(
31
+ server_name="0.0.0.0",
32
+ server_port=7860,
33
+ inline=True, # Ensures the app is embedded directly
34
+ share=False # Disable public sharing (optional)
35
+ )
36
+
37
+ # Add an iframe to embed the Fooocus UI
38
+ gr.HTML(f"""
39
+ <iframe src="http://localhost:7860" width="100%" height="800px"></iframe>
40
+ """)