signsur4739379373 commited on
Commit
0bc6d3a
·
1 Parent(s): e54b04d

Fix filtered Comfy dependencies

Browse files
Files changed (2) hide show
  1. app.py +4 -2
  2. requirements.txt +1 -0
app.py CHANGED
@@ -6,6 +6,7 @@ import json
6
  import os
7
  import pathlib
8
  import random
 
9
  import shutil
10
  import subprocess
11
  import sys
@@ -121,14 +122,15 @@ def _pip_install(args: list[str], check: bool = True) -> None:
121
  def _install_filtered_requirements(req_path: pathlib.Path) -> None:
122
  if not req_path.exists():
123
  return
124
- blocked = ("torch", "torchvision", "torchaudio", "transformers", "huggingface-hub", "accelerate")
125
  safe: list[str] = []
126
  for line in req_path.read_text(encoding="utf-8", errors="ignore").splitlines():
127
  item = line.strip()
128
  if not item or item.startswith("#"):
129
  continue
130
  low = item.lower().replace("_", "-")
131
- if any(low.startswith(name) for name in blocked):
 
132
  continue
133
  safe.append(item)
134
  if safe:
 
6
  import os
7
  import pathlib
8
  import random
9
+ import re
10
  import shutil
11
  import subprocess
12
  import sys
 
122
  def _install_filtered_requirements(req_path: pathlib.Path) -> None:
123
  if not req_path.exists():
124
  return
125
+ blocked = {"torch", "torchvision", "torchaudio", "transformers", "huggingface-hub", "accelerate"}
126
  safe: list[str] = []
127
  for line in req_path.read_text(encoding="utf-8", errors="ignore").splitlines():
128
  item = line.strip()
129
  if not item or item.startswith("#"):
130
  continue
131
  low = item.lower().replace("_", "-")
132
+ package = re.split(r"[<>=!~;\[\s]", low, maxsplit=1)[0]
133
+ if package in blocked:
134
  continue
135
  safe.append(item)
136
  if safe:
requirements.txt CHANGED
@@ -2,6 +2,7 @@
2
  torch==2.8.0
3
  torchvision==0.23.0
4
  torchaudio==2.8.0
 
5
  spaces
6
  gradio>=5,<6
7
  huggingface_hub>=0.34.0
 
2
  torch==2.8.0
3
  torchvision==0.23.0
4
  torchaudio==2.8.0
5
+ torchsde
6
  spaces
7
  gradio>=5,<6
8
  huggingface_hub>=0.34.0