Singularity666 commited on
Commit
d7692e9
Β·
verified Β·
1 Parent(s): 8c79566

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -4,10 +4,7 @@ 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():
@@ -16,8 +13,19 @@ def clone_repo():
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}"
@@ -27,7 +35,6 @@ def run_fooocus(theme="dark", preset="default", advanced_args="--attention-split
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:
@@ -47,9 +54,5 @@ if __name__ == "__main__":
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()
 
4
  import importlib
5
 
6
  def setup_environment():
 
7
  subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "pip"])
 
 
8
  subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", "gradio==4.29.0", "pygit2==1.12.2"])
9
 
10
  def clone_repo():
 
13
  subprocess.check_call(["git", "clone", repo_url])
14
  os.chdir("Automated_DeFooocus")
15
 
16
+ # Install requirements, ignoring torchsde
17
+ with open("requirements_versions.txt", "r") as f:
18
+ requirements = f.read().splitlines()
19
+
20
+ filtered_requirements = [req for req in requirements if not req.startswith("torchsde")]
21
+
22
+ with open("temp_requirements.txt", "w") as f:
23
+ f.write("\n".join(filtered_requirements))
24
+
25
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "temp_requirements.txt", "--ignore-installed"])
26
+
27
+ # Install torchsde separately
28
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "torchsde==0.2.6", "--no-deps"])
29
 
30
  def run_fooocus(theme="dark", preset="default", advanced_args="--attention-split --always-high-vram --disable-offload-from-vram --all-in-fp16"):
31
  args = f"{advanced_args} --theme {theme}"
 
35
  subprocess.Popen([sys.executable, "entry_with_update.py"] + args.split())
36
 
37
  def launch_interface():
 
38
  import gradio as gr
39
 
40
  with gr.Blocks() as demo:
 
54
  setup_environment()
55
  clone_repo()
56
  print("[DeFooocus] Starting ...")
 
 
 
 
57
  demo = launch_interface()
58
  demo.launch()