John6666 commited on
Commit
3fba243
·
verified ·
1 Parent(s): 95cc11c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -1,4 +1,4 @@
1
- import os
2
  import spaces
3
  import gradio as gr
4
  from functools import partial
@@ -20,6 +20,8 @@ from PIL import Image, ImageDraw
20
  from torchvision.transforms.functional import to_pil_image
21
  from ultralytics import YOLO
22
 
 
 
23
  def create_mask_from_bbox(
24
  bboxes: np.ndarray, shape: tuple[int, int]
25
  ) -> list[Image.Image]:
@@ -90,8 +92,14 @@ def infer(text: str):
90
  person_model_path = hf_hub_download("Bingsu/adetailer", "person_yolov8s-seg.pt")
91
  person_detector = partial(yolo_detector, model_path=person_model_path)
92
  detectors.append(person_detector)
93
-
94
- init_image = Image.open("./image.webp")
 
 
 
 
 
 
95
  for j, detector in enumerate(detectors):
96
  masks = detector(init_image)
97
  return str(masks)
 
1
+ import os, subprocess
2
  import spaces
3
  import gradio as gr
4
  from functools import partial
 
20
  from torchvision.transforms.functional import to_pil_image
21
  from ultralytics import YOLO
22
 
23
+ subprocess.run("pip list", shell=True)
24
+
25
  def create_mask_from_bbox(
26
  bboxes: np.ndarray, shape: tuple[int, int]
27
  ) -> list[Image.Image]:
 
92
  person_model_path = hf_hub_download("Bingsu/adetailer", "person_yolov8s-seg.pt")
93
  person_detector = partial(yolo_detector, model_path=person_model_path)
94
  detectors.append(person_detector)
95
+ face_model_path = hf_hub_download("Bingsu/adetailer", "face_yolov8n.pt")
96
+ face_detector = partial(yolo_detector, model_path=face_model_path)
97
+ detectors.append(face_detector)
98
+ hand_model_path = hf_hub_download("Bingsu/adetailer", "hand_yolov8n.pt")
99
+ hand_detector = partial(yolo_detector, model_path=hand_model_path)
100
+ detectors.append(hand_detector)
101
+ init_image = Image.open("./image.webp").convert("RGB")
102
+ masks = None
103
  for j, detector in enumerate(detectors):
104
  masks = detector(init_image)
105
  return str(masks)