Spaces:
Paused
Paused
| import os | |
| import subprocess | |
| import sys | |
| # Fungsi untuk setup Fooocus | |
| def setup_fooocus(): | |
| # Kloning repositori Fooocus jika belum ada | |
| if not os.path.exists("Fooocus"): | |
| print("Cloning Fooocus repository...") | |
| subprocess.run(["git", "clone", "https://github.com/lllyasviel/Fooocus.git"]) | |
| else: | |
| print("Fooocus repository already exists.") | |
| # Pindah ke direktori Fooocus | |
| os.chdir("Fooocus") | |
| print(f"Current working directory: {os.getcwd()}") | |
| # Pastikan requirements.txt ada | |
| if not os.path.exists("requirements.txt"): | |
| print("Creating requirements.txt...") | |
| with open("requirements.txt", "w") as f: | |
| f.write(""" | |
| torch>=2.0.1 | |
| torchvision | |
| numpy | |
| opencv-python | |
| requests | |
| gradio>=3.50.2 | |
| Pillow | |
| psutil | |
| pyyaml | |
| safetensors | |
| tqdm | |
| pygit2==1.15.1 | |
| """) | |
| # Instal dependensi | |
| print("Installing dependencies...") | |
| subprocess.run([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"]) | |
| # Jalankan setup | |
| setup_fooocus() | |
| # Jalankan Fooocus | |
| print("Starting Fooocus...") | |
| subprocess.run([sys.executable, "entry_with_update.py", "--always-high-vram"]) |