Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,31 +1,35 @@
|
|
1 |
import os
|
2 |
import sys
|
3 |
import subprocess
|
4 |
-
import
|
5 |
|
6 |
def setup_environment():
|
7 |
-
#
|
8 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "
|
|
|
|
|
|
|
9 |
|
10 |
def clone_repo():
|
11 |
-
# Clone the repository
|
12 |
repo_url = "https://github.com/Cardano-max/Automated_DeFooocus.git"
|
13 |
if not os.path.exists("Automated_DeFooocus"):
|
14 |
subprocess.check_call(["git", "clone", repo_url])
|
15 |
os.chdir("Automated_DeFooocus")
|
16 |
|
17 |
-
#
|
18 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "-
|
19 |
|
20 |
def run_fooocus(theme="dark", preset="default", advanced_args="--attention-split --always-high-vram --disable-offload-from-vram --all-in-fp16"):
|
21 |
args = f"{advanced_args} --theme {theme}"
|
22 |
if preset != "default":
|
23 |
args += f" --preset {preset}"
|
24 |
|
25 |
-
# Run the entry_with_update.py script
|
26 |
subprocess.Popen([sys.executable, "entry_with_update.py"] + args.split())
|
27 |
|
28 |
def launch_interface():
|
|
|
|
|
|
|
29 |
with gr.Blocks() as demo:
|
30 |
gr.Markdown("# DeFooocus Interface")
|
31 |
with gr.Row():
|
@@ -43,5 +47,9 @@ if __name__ == "__main__":
|
|
43 |
setup_environment()
|
44 |
clone_repo()
|
45 |
print("[DeFooocus] Starting ...")
|
|
|
|
|
|
|
|
|
46 |
demo = launch_interface()
|
47 |
demo.launch()
|
|
|
1 |
import os
|
2 |
import sys
|
3 |
import subprocess
|
4 |
+
import importlib
|
5 |
|
6 |
def setup_environment():
|
7 |
+
# Update pip
|
8 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
|
9 |
+
|
10 |
+
# Install or upgrade gradio and pygit2
|
11 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "gradio==4.29.0", "pygit2==1.12.2"])
|
12 |
|
13 |
def clone_repo():
|
|
|
14 |
repo_url = "https://github.com/Cardano-max/Automated_DeFooocus.git"
|
15 |
if not os.path.exists("Automated_DeFooocus"):
|
16 |
subprocess.check_call(["git", "clone", repo_url])
|
17 |
os.chdir("Automated_DeFooocus")
|
18 |
|
19 |
+
# Install requirements, ignoring conflicts
|
20 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements_versions.txt", "--ignore-installed"])
|
21 |
|
22 |
def run_fooocus(theme="dark", preset="default", advanced_args="--attention-split --always-high-vram --disable-offload-from-vram --all-in-fp16"):
|
23 |
args = f"{advanced_args} --theme {theme}"
|
24 |
if preset != "default":
|
25 |
args += f" --preset {preset}"
|
26 |
|
|
|
27 |
subprocess.Popen([sys.executable, "entry_with_update.py"] + args.split())
|
28 |
|
29 |
def launch_interface():
|
30 |
+
# Import gradio here to ensure we're using the correct version
|
31 |
+
import gradio as gr
|
32 |
+
|
33 |
with gr.Blocks() as demo:
|
34 |
gr.Markdown("# DeFooocus Interface")
|
35 |
with gr.Row():
|
|
|
47 |
setup_environment()
|
48 |
clone_repo()
|
49 |
print("[DeFooocus] Starting ...")
|
50 |
+
|
51 |
+
# Reload the gradio module to ensure we're using the correct version
|
52 |
+
importlib.reload(sys.modules['gradio'])
|
53 |
+
|
54 |
demo = launch_interface()
|
55 |
demo.launch()
|