Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
#
|
| 13 |
def start_fooocus():
|
| 14 |
-
# Run Fooocus
|
| 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!
|
| 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 |
-
#
|
| 30 |
-
iface.launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
""")
|