Spaces:
Running
on
Zero
Running
on
Zero
Rishi Desai
commited on
Commit
·
59fed21
1
Parent(s):
6e78bcc
moving to torch 2.5.1 for zerogpu
Browse files- demo.py +2 -2
- face_enhance.py +2 -2
- install.py +8 -1
- requirements.txt +2 -175
demo.py
CHANGED
@@ -5,7 +5,7 @@ if "HF_DEMO" in os.environ:
|
|
5 |
# Global variable to track if install() has been run; only for deploying on HF space
|
6 |
INSTALLED = False
|
7 |
if not INSTALLED:
|
8 |
-
install()
|
9 |
INSTALLED = True
|
10 |
|
11 |
import gradio as gr
|
@@ -148,7 +148,7 @@ def create_gradio_interface():
|
|
148 |
demo.queue(max_size=99)
|
149 |
|
150 |
try:
|
151 |
-
demo.launch()
|
152 |
except OSError as e:
|
153 |
print(f"Error starting server: {e}")
|
154 |
sys.exit(1)
|
|
|
5 |
# Global variable to track if install() has been run; only for deploying on HF space
|
6 |
INSTALLED = False
|
7 |
if not INSTALLED:
|
8 |
+
install(is_hf_demo=True)
|
9 |
INSTALLED = True
|
10 |
|
11 |
import gradio as gr
|
|
|
148 |
demo.queue(max_size=99)
|
149 |
|
150 |
try:
|
151 |
+
demo.launch(share=True)
|
152 |
except OSError as e:
|
153 |
print(f"Error starting server: {e}")
|
154 |
sys.exit(1)
|
face_enhance.py
CHANGED
@@ -3,7 +3,7 @@ import random
|
|
3 |
import sys
|
4 |
from typing import Sequence, Mapping, Any, Union
|
5 |
import torch
|
6 |
-
|
7 |
COMFYUI_PATH = "./ComfyUI"
|
8 |
|
9 |
"""
|
@@ -313,7 +313,7 @@ def save_comfy_images(images, output_dirs):
|
|
313 |
pil_image = Image.fromarray(numpy_image)
|
314 |
pil_image.save(output_dirs[idx])
|
315 |
|
316 |
-
|
317 |
def face_enhance(face_image: str, input_image: str, output_image: str, dist_image: str = None, positive_prompt: str = "", id_weight: float = 0.75):
|
318 |
initialize_models() # Ensure models are loaded
|
319 |
main(face_image, input_image, output_image, dist_image, positive_prompt, id_weight)
|
|
|
3 |
import sys
|
4 |
from typing import Sequence, Mapping, Any, Union
|
5 |
import torch
|
6 |
+
import spaces
|
7 |
COMFYUI_PATH = "./ComfyUI"
|
8 |
|
9 |
"""
|
|
|
313 |
pil_image = Image.fromarray(numpy_image)
|
314 |
pil_image.save(output_dirs[idx])
|
315 |
|
316 |
+
@spaces.GPU
|
317 |
def face_enhance(face_image: str, input_image: str, output_image: str, dist_image: str = None, positive_prompt: str = "", id_weight: float = 0.75):
|
318 |
initialize_models() # Ensure models are loaded
|
319 |
main(face_image, input_image, output_image, dist_image, positive_prompt, id_weight)
|
install.py
CHANGED
@@ -202,12 +202,19 @@ def install_custom_nodes():
|
|
202 |
print("✅ Installed and updated all ComfyUI nodes.")
|
203 |
|
204 |
|
205 |
-
def
|
|
|
|
|
|
|
|
|
|
|
206 |
install_lfs_files()
|
207 |
install_comfyui()
|
208 |
install_custom_nodes()
|
209 |
download_huggingface_models()
|
210 |
download_and_extract_antelopev2()
|
|
|
|
|
211 |
print("🎉 Setup Complete!")
|
212 |
|
213 |
if __name__ == "__main__":
|
|
|
202 |
print("✅ Installed and updated all ComfyUI nodes.")
|
203 |
|
204 |
|
205 |
+
def install_hfdemo_dependencies():
|
206 |
+
run_cmd("python -m pip install torch==2.5.1 torchvision==0.20.1 torchaudio==2.5.1 --index-url https://download.pytorch.org/whl/cu124")
|
207 |
+
run_cmd("python -m pip install -r requirements.txt")
|
208 |
+
|
209 |
+
|
210 |
+
def install(is_hf_demo=False):
|
211 |
install_lfs_files()
|
212 |
install_comfyui()
|
213 |
install_custom_nodes()
|
214 |
download_huggingface_models()
|
215 |
download_and_extract_antelopev2()
|
216 |
+
if is_hf_demo:
|
217 |
+
install_hfdemo_dependencies()
|
218 |
print("🎉 Setup Complete!")
|
219 |
|
220 |
if __name__ == "__main__":
|
requirements.txt
CHANGED
@@ -1,176 +1,3 @@
|
|
1 |
-
aiofiles==24.1.0
|
2 |
-
aiohappyeyeballs==2.6.1
|
3 |
-
aiohttp==3.11.16
|
4 |
-
aiosignal==1.3.2
|
5 |
-
albucore==0.0.23
|
6 |
-
albumentations==2.0.5
|
7 |
-
annotated-types==0.7.0
|
8 |
-
anyio==4.9.0
|
9 |
-
arrow==1.3.0
|
10 |
-
attrs==25.3.0
|
11 |
-
av==14.3.0
|
12 |
-
binaryornot==0.4.4
|
13 |
-
certifi==2025.1.31
|
14 |
-
cffi==1.17.1
|
15 |
-
chardet==5.2.0
|
16 |
-
charset-normalizer==3.4.1
|
17 |
-
click==8.1.8
|
18 |
-
coloredlogs==15.0.1
|
19 |
-
comfy-cli==1.3.8
|
20 |
-
comfyui_frontend_package==1.15.13
|
21 |
-
contourpy==1.3.2
|
22 |
-
cookiecutter==2.6.0
|
23 |
-
cryptography==44.0.2
|
24 |
-
cycler==0.12.1
|
25 |
-
Cython==3.0.12
|
26 |
-
Deprecated==1.2.18
|
27 |
-
distro==1.9.0
|
28 |
-
dnspython==2.7.0
|
29 |
-
easydict==1.13
|
30 |
-
einops==0.8.1
|
31 |
-
email_validator==2.2.0
|
32 |
-
facexlib==0.3.0
|
33 |
-
fal_client==0.5.9
|
34 |
-
fastapi==0.115.12
|
35 |
-
fastapi-cli==0.0.7
|
36 |
-
ffmpy==0.5.0
|
37 |
-
filelock==3.18.0
|
38 |
-
filterpy==1.4.5
|
39 |
-
flatbuffers==25.2.10
|
40 |
-
fonttools==4.57.0
|
41 |
-
frozenlist==1.5.0
|
42 |
-
fsspec==2025.3.2
|
43 |
-
ftfy==6.3.1
|
44 |
-
gitdb==4.0.12
|
45 |
-
GitPython==3.1.44
|
46 |
gradio==5.25.2
|
47 |
-
|
48 |
-
|
49 |
-
h11==0.14.0
|
50 |
-
hf_transfer==0.1.9
|
51 |
-
httpcore==1.0.8
|
52 |
-
httptools==0.6.4
|
53 |
-
httpx==0.28.1
|
54 |
-
httpx-sse==0.4.0
|
55 |
-
huggingface-hub==0.30.2
|
56 |
-
humanfriendly==10.0
|
57 |
-
idna==3.10
|
58 |
-
imageio==2.37.0
|
59 |
-
insightface==0.7.3
|
60 |
-
Jinja2==3.1.6
|
61 |
-
jiter==0.9.0
|
62 |
-
joblib==1.4.2
|
63 |
-
kiwisolver==1.4.8
|
64 |
-
kornia==0.8.0
|
65 |
-
kornia_rs==0.1.8
|
66 |
-
lazy_loader==0.4
|
67 |
-
llvmlite==0.44.0
|
68 |
-
markdown-it-py==3.0.0
|
69 |
-
MarkupSafe==3.0.2
|
70 |
-
matplotlib==3.10.1
|
71 |
-
matrix-client==0.4.0
|
72 |
-
mdurl==0.1.2
|
73 |
-
mixpanel==4.10.1
|
74 |
-
mpmath==1.3.0
|
75 |
-
multidict==6.4.3
|
76 |
-
networkx==3.4.2
|
77 |
-
numba==0.61.2
|
78 |
-
numpy==2.2.4
|
79 |
-
nvidia-cublas-cu12==12.4.5.8
|
80 |
-
nvidia-cuda-cupti-cu12==12.4.127
|
81 |
-
nvidia-cuda-nvrtc-cu12==12.4.127
|
82 |
-
nvidia-cuda-runtime-cu12==12.4.127
|
83 |
-
nvidia-cudnn-cu12==9.1.0.70
|
84 |
-
nvidia-cufft-cu12==11.2.1.3
|
85 |
-
nvidia-curand-cu12==10.3.5.147
|
86 |
-
nvidia-cusolver-cu12==11.6.1.9
|
87 |
-
nvidia-cusparse-cu12==12.3.1.170
|
88 |
-
nvidia-cusparselt-cu12==0.6.2
|
89 |
-
nvidia-nccl-cu12==2.21.5
|
90 |
-
nvidia-nvjitlink-cu12==12.4.127
|
91 |
-
nvidia-nvtx-cu12==12.4.127
|
92 |
-
onnx==1.17.0
|
93 |
-
onnxruntime==1.21.0
|
94 |
-
onnxruntime-gpu==1.21.0
|
95 |
-
openai==1.75.0
|
96 |
-
opencv-python==4.11.0.86
|
97 |
-
opencv-python-headless==4.11.0.86
|
98 |
-
orjson==3.10.16
|
99 |
-
packaging==24.2
|
100 |
-
pandas==2.2.3
|
101 |
-
pathspec==0.12.1
|
102 |
-
pillow==11.2.1
|
103 |
-
prettytable==3.16.0
|
104 |
-
prompt_toolkit==3.0.51
|
105 |
-
propcache==0.3.1
|
106 |
-
protobuf==6.30.2
|
107 |
-
psutil==7.0.0
|
108 |
-
pycparser==2.22
|
109 |
-
pydantic==2.11.3
|
110 |
-
pydantic_core==2.33.1
|
111 |
-
pydub==0.25.1
|
112 |
-
PyGithub==2.6.1
|
113 |
-
Pygments==2.19.1
|
114 |
-
PyJWT==2.10.1
|
115 |
-
PyNaCl==1.5.0
|
116 |
-
pyparsing==3.2.3
|
117 |
-
python-dateutil==2.9.0.post0
|
118 |
-
python-dotenv==1.1.0
|
119 |
-
python-multipart==0.0.20
|
120 |
-
python-slugify==8.0.4
|
121 |
-
pytz==2025.2
|
122 |
-
PyYAML==6.0.2
|
123 |
-
questionary==2.1.0
|
124 |
-
regex==2024.11.6
|
125 |
-
requests==2.32.3
|
126 |
-
rich==14.0.0
|
127 |
-
rich-toolkit==0.14.1
|
128 |
-
ruff==0.11.5
|
129 |
-
safehttpx==0.1.6
|
130 |
-
safetensors==0.5.3
|
131 |
-
scikit-image==0.25.2
|
132 |
-
scikit-learn==1.6.1
|
133 |
-
scipy==1.15.2
|
134 |
-
semantic-version==2.10.0
|
135 |
-
semver==3.0.4
|
136 |
-
sentencepiece==0.2.0
|
137 |
-
shellingham==1.5.4
|
138 |
-
simsimd==6.2.1
|
139 |
-
six==1.17.0
|
140 |
-
smmap==5.0.2
|
141 |
-
sniffio==1.3.1
|
142 |
-
soundfile==0.13.1
|
143 |
-
spandrel==0.4.1
|
144 |
-
starlette==0.46.2
|
145 |
-
stringzilla==3.12.4
|
146 |
-
sympy==1.13.1
|
147 |
-
text-unidecode==1.3
|
148 |
-
threadpoolctl==3.6.0
|
149 |
-
tifffile==2025.3.30
|
150 |
-
timm==1.0.15
|
151 |
-
tokenizers==0.21.1
|
152 |
-
toml==0.10.2
|
153 |
-
tomlkit==0.13.2
|
154 |
-
torch==2.6.0
|
155 |
-
torchaudio==2.6.0
|
156 |
-
torchsde==0.2.6
|
157 |
-
torchvision==0.21.0
|
158 |
-
tqdm==4.67.1
|
159 |
-
trampoline==0.1.2
|
160 |
-
transformers==4.51.3
|
161 |
-
triton==3.2.0
|
162 |
-
typer==0.15.2
|
163 |
-
types-python-dateutil==2.9.0.20241206
|
164 |
-
typing-inspection==0.4.0
|
165 |
-
typing_extensions==4.13.2
|
166 |
-
tzdata==2025.2
|
167 |
-
urllib3==1.26.20
|
168 |
-
uv==0.6.14
|
169 |
-
uvicorn==0.34.1
|
170 |
-
uvloop==0.21.0
|
171 |
-
watchfiles==1.0.5
|
172 |
-
wcwidth==0.2.13
|
173 |
-
websocket-client==1.8.0
|
174 |
-
websockets==15.0.1
|
175 |
-
wrapt==1.17.2
|
176 |
-
yarl==1.20.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
gradio==5.25.2
|
2 |
+
pillow
|
3 |
+
spaces
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|