Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,4 @@
|
|
| 1 |
import os
|
| 2 |
-
import subprocess
|
| 3 |
-
import time
|
| 4 |
-
import gradio as gr
|
| 5 |
|
| 6 |
# Change directory to Fooocus
|
| 7 |
os.chdir("Fooocus-main")
|
|
@@ -9,32 +6,5 @@ os.chdir("Fooocus-main")
|
|
| 9 |
# Install dependencies
|
| 10 |
os.system("pip install pygit2==1.15.1")
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
| 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,
|
| 23 |
-
outputs="text",
|
| 24 |
-
live=True,
|
| 25 |
-
title="Fooocus AI",
|
| 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 |
-
""")
|
|
|
|
| 1 |
import os
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
# Change directory to Fooocus
|
| 4 |
os.chdir("Fooocus-main")
|
|
|
|
| 6 |
# Install dependencies
|
| 7 |
os.system("pip install pygit2==1.15.1")
|
| 8 |
|
| 9 |
+
# Run Fooocus
|
| 10 |
+
os.system("python entry_with_update.py --always-cpu")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|