Spaces:
Runtime error
Runtime error
Fix segmentation masks and dependencies
Browse files- app/segmentation.py +3 -1
- requirements.txt +13 -0
app/segmentation.py
CHANGED
|
@@ -75,7 +75,7 @@ class SemanticSegmenter:
|
|
| 75 |
img_proc = img.resize(new_size, resample=Image.BILINEAR)
|
| 76 |
|
| 77 |
def _split_prompts(text: str) -> list[str]:
|
| 78 |
-
parts = [p.strip() for p in re.split(r"[
|
| 79 |
return parts if parts else ([text.strip()] if text.strip() else [])
|
| 80 |
|
| 81 |
masks: dict[str, np.ndarray] = {}
|
|
@@ -173,6 +173,8 @@ class SegmenterService:
|
|
| 173 |
result["water"] = masks["water"]
|
| 174 |
if request.want_road and masks.get("road") is not None:
|
| 175 |
result["road"] = masks["road"]
|
|
|
|
|
|
|
| 176 |
return result
|
| 177 |
|
| 178 |
|
|
|
|
| 75 |
img_proc = img.resize(new_size, resample=Image.BILINEAR)
|
| 76 |
|
| 77 |
def _split_prompts(text: str) -> list[str]:
|
| 78 |
+
parts = [p.strip() for p in re.split(r"[;,\n]", text) if p.strip()]
|
| 79 |
return parts if parts else ([text.strip()] if text.strip() else [])
|
| 80 |
|
| 81 |
masks: dict[str, np.ndarray] = {}
|
|
|
|
| 173 |
result["water"] = masks["water"]
|
| 174 |
if request.want_road and masks.get("road") is not None:
|
| 175 |
result["road"] = masks["road"]
|
| 176 |
+
if request.want_tree and masks.get("tree") is not None:
|
| 177 |
+
result["tree"] = masks["tree"]
|
| 178 |
return result
|
| 179 |
|
| 180 |
|
requirements.txt
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
gradio>=3.50
|
|
|
|
|
|
|
|
|
|
| 2 |
numpy
|
|
|
|
| 3 |
opencv-python
|
| 4 |
Pillow
|
|
|
|
|
|
|
| 5 |
pyyaml
|
| 6 |
torch
|
|
|
|
|
|
|
| 7 |
transformers>=4.39
|
|
|
|
|
|
|
|
|
| 1 |
+
addict
|
| 2 |
+
einops
|
| 3 |
+
fastapi
|
| 4 |
gradio>=3.50
|
| 5 |
+
huggingface-hub
|
| 6 |
+
imageio
|
| 7 |
+
matplotlib
|
| 8 |
numpy
|
| 9 |
+
omegaconf
|
| 10 |
opencv-python
|
| 11 |
Pillow
|
| 12 |
+
pillow-heif
|
| 13 |
+
pydantic
|
| 14 |
pyyaml
|
| 15 |
torch
|
| 16 |
+
torchvision
|
| 17 |
+
tqdm
|
| 18 |
transformers>=4.39
|
| 19 |
+
typer
|
| 20 |
+
uvicorn
|