Spaces:
Runtime error
Runtime error
Man-isH-07
commited on
Commit
·
98cb2c7
1
Parent(s):
7ce0c69
v1.9
Browse files- Dockerfile +11 -3
- app.py +33 -11
Dockerfile
CHANGED
@@ -4,13 +4,21 @@ FROM python:3.10
|
|
4 |
# Install git
|
5 |
RUN apt-get update && apt-get install -y git
|
6 |
|
7 |
-
|
8 |
WORKDIR /home/user/app
|
9 |
|
10 |
-
|
11 |
# Copy all files to the container
|
12 |
COPY . .
|
13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
# Install dependencies
|
15 |
RUN pip install --no-cache-dir --upgrade pip
|
16 |
RUN pip install "inference[transformers,sam,clip,gaze,grounding-dino,yolo-world]" xformers torchvision torchaudio supervision onnxruntime onnxruntime-gpu --extra-index-url https://download.pytorch.org/whl/cu124
|
@@ -21,4 +29,4 @@ RUN pip install aiohttp==3.10.11
|
|
21 |
EXPOSE 7860
|
22 |
|
23 |
# Command to run the app
|
24 |
-
CMD ["python", "app.py"]
|
|
|
4 |
# Install git
|
5 |
RUN apt-get update && apt-get install -y git
|
6 |
|
|
|
7 |
WORKDIR /home/user/app
|
8 |
|
|
|
9 |
# Copy all files to the container
|
10 |
COPY . .
|
11 |
|
12 |
+
# Clone custom node repositories
|
13 |
+
RUN git clone https://github.com/Fannovel16/ComfyUI-YoloWorld-EfficientSAM.git custom_nodes/ComfyUI-YoloWorld-EfficientSAM
|
14 |
+
RUN git clone https://github.com/Acly/comfyui-inpaint-nodes.git custom_nodes/comfyui-inpaint-nodes
|
15 |
+
RUN git clone https://github.com/rgthree/rgthree-comfy.git custom_nodes/rgthree-comfy
|
16 |
+
|
17 |
+
# Install dependencies for custom nodes (if they have requirements.txt)
|
18 |
+
RUN if [ -f "custom_nodes/ComfyUI-YoloWorld-EfficientSAM/requirements.txt" ]; then pip install -r custom_nodes/ComfyUI-YoloWorld-EfficientSAM/requirements.txt; fi
|
19 |
+
RUN if [ -f "custom_nodes/comfyui-inpaint-nodes/requirements.txt" ]; then pip install -r custom_nodes/comfyui-inpaint-nodes/requirements.txt; fi
|
20 |
+
RUN if [ -f "custom_nodes/rgthree-comfy/requirements.txt" ]; then pip install -r custom_nodes/rgthree-comfy/requirements.txt; fi
|
21 |
+
|
22 |
# Install dependencies
|
23 |
RUN pip install --no-cache-dir --upgrade pip
|
24 |
RUN pip install "inference[transformers,sam,clip,gaze,grounding-dino,yolo-world]" xformers torchvision torchaudio supervision onnxruntime onnxruntime-gpu --extra-index-url https://download.pytorch.org/whl/cu124
|
|
|
29 |
EXPOSE 7860
|
30 |
|
31 |
# Command to run the app
|
32 |
+
CMD ["python", "app.py"]
|
app.py
CHANGED
@@ -181,6 +181,13 @@ def import_custom_nodes() -> None:
|
|
181 |
from nodes import init_extra_nodes
|
182 |
import server
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
# Creating a new event loop and setting it as the default loop
|
185 |
loop = asyncio.new_event_loop()
|
186 |
asyncio.set_event_loop(loop)
|
@@ -292,14 +299,32 @@ def object_remover(object_name, image) :
|
|
292 |
return "Error: Image generation failed."
|
293 |
|
294 |
|
295 |
-
#
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
|
304 |
esam_modelloader_zho = NODE_CLASS_MAPPINGS["ESAM_ModelLoader_Zho"]()
|
305 |
esam_modelloader_zho_4 = esam_modelloader_zho.load_esam_model(device="CUDA")
|
@@ -314,12 +339,10 @@ vaeloader_20 = vaeloader.load_vae(
|
|
314 |
vae_name="vae-ft-mse-840000-ema-pruned.safetensors"
|
315 |
)
|
316 |
|
317 |
-
|
318 |
loadimage = NODE_CLASS_MAPPINGS["LoadImage"]()
|
319 |
yoloworld_esam_zho = NODE_CLASS_MAPPINGS["Yoloworld_ESAM_Zho"]()
|
320 |
growmask = NODE_CLASS_MAPPINGS["GrowMask"]()
|
321 |
inpaint_inpaintwithmodel = NODE_CLASS_MAPPINGS["INPAINT_InpaintWithModel"]()
|
322 |
-
vaeloader = NODE_CLASS_MAPPINGS["VAELoader"]()
|
323 |
vaeencode = NODE_CLASS_MAPPINGS["VAEEncode"]()
|
324 |
masktoimage = NODE_CLASS_MAPPINGS["MaskToImage"]()
|
325 |
vaedecode = NODE_CLASS_MAPPINGS["VAEDecode"]()
|
@@ -327,7 +350,6 @@ image_comparer_rgthree = NODE_CLASS_MAPPINGS["Image Comparer (rgthree)"]()
|
|
327 |
saveimage = NODE_CLASS_MAPPINGS["SaveImage"]()
|
328 |
|
329 |
|
330 |
-
|
331 |
#Add all the models that load a safetensors file
|
332 |
model_loaders = [yoloworld_modelloader_zho_3,esam_modelloader_zho_4,inpaint_loadinpaintmodel_13,vaeloader_20]
|
333 |
|
|
|
181 |
from nodes import init_extra_nodes
|
182 |
import server
|
183 |
|
184 |
+
# Debug: List contents of custom_nodes/
|
185 |
+
print("Custom nodes directory contents:", os.listdir('custom_nodes'))
|
186 |
+
for node_dir in os.listdir('custom_nodes'):
|
187 |
+
node_path = os.path.join('custom_nodes', node_dir)
|
188 |
+
if os.path.isdir(node_path):
|
189 |
+
print(f"Contents of {node_dir}:", os.listdir(node_path))
|
190 |
+
|
191 |
# Creating a new event loop and setting it as the default loop
|
192 |
loop = asyncio.new_event_loop()
|
193 |
asyncio.set_event_loop(loop)
|
|
|
299 |
return "Error: Image generation failed."
|
300 |
|
301 |
|
302 |
+
# Check for all required custom nodes
|
303 |
+
required_nodes = [
|
304 |
+
"Yoloworld_ModelLoader_Zho",
|
305 |
+
"ESAM_ModelLoader_Zho",
|
306 |
+
"Yoloworld_ESAM_Zho",
|
307 |
+
"INPAINT_InpaintWithModel",
|
308 |
+
"INPAINT_LoadInpaintModel",
|
309 |
+
"Image Comparer (rgthree)",
|
310 |
+
"GrowMask",
|
311 |
+
"MaskToImage",
|
312 |
+
"VAEEncode",
|
313 |
+
"VAEDecode",
|
314 |
+
"VAELoader",
|
315 |
+
"LoadImage",
|
316 |
+
"SaveImage"
|
317 |
+
]
|
318 |
+
|
319 |
+
missing_nodes = [node for node in required_nodes if node not in NODE_CLASS_MAPPINGS]
|
320 |
+
if missing_nodes:
|
321 |
+
raise KeyError(f"❌ Error: The following required nodes were not found: {missing_nodes}. Check if custom nodes are loaded correctly.")
|
322 |
+
|
323 |
+
# Load the nodes
|
324 |
+
yoloworld_modelloader_zho = NODE_CLASS_MAPPINGS["Yoloworld_ModelLoader_Zho"]()
|
325 |
+
yoloworld_modelloader_zho_3 = yoloworld_modelloader_zho.load_yolo_world_model(
|
326 |
+
yolo_world_model="yolo_world/m"
|
327 |
+
)
|
328 |
|
329 |
esam_modelloader_zho = NODE_CLASS_MAPPINGS["ESAM_ModelLoader_Zho"]()
|
330 |
esam_modelloader_zho_4 = esam_modelloader_zho.load_esam_model(device="CUDA")
|
|
|
339 |
vae_name="vae-ft-mse-840000-ema-pruned.safetensors"
|
340 |
)
|
341 |
|
|
|
342 |
loadimage = NODE_CLASS_MAPPINGS["LoadImage"]()
|
343 |
yoloworld_esam_zho = NODE_CLASS_MAPPINGS["Yoloworld_ESAM_Zho"]()
|
344 |
growmask = NODE_CLASS_MAPPINGS["GrowMask"]()
|
345 |
inpaint_inpaintwithmodel = NODE_CLASS_MAPPINGS["INPAINT_InpaintWithModel"]()
|
|
|
346 |
vaeencode = NODE_CLASS_MAPPINGS["VAEEncode"]()
|
347 |
masktoimage = NODE_CLASS_MAPPINGS["MaskToImage"]()
|
348 |
vaedecode = NODE_CLASS_MAPPINGS["VAEDecode"]()
|
|
|
350 |
saveimage = NODE_CLASS_MAPPINGS["SaveImage"]()
|
351 |
|
352 |
|
|
|
353 |
#Add all the models that load a safetensors file
|
354 |
model_loaders = [yoloworld_modelloader_zho_3,esam_modelloader_zho_4,inpaint_loadinpaintmodel_13,vaeloader_20]
|
355 |
|