Martin Tomov commited on
Commit
1052aa8
·
verified ·
1 Parent(s): 1dff9a5

another app.py update to plot correct outputs

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -112,7 +112,7 @@ def detect(image: Image.Image, labels: List[str], threshold: float = 0.3, detect
112
  results = object_detector(image, candidate_labels=labels, threshold=threshold)
113
  return [DetectionResult.from_dict(result) for result in results]
114
 
115
- @spaces.GPU
116
  def segment(image: Image.Image, detection_results: List[DetectionResult], polygon_refinement: bool = False, segmenter_id: Optional[str] = None) -> List[DetectionResult]:
117
  segmenter_id = segmenter_id if segmenter_id else "martintmv/InsectSAM"
118
  segmentator = AutoModelForMaskGeneration.from_pretrained(segmenter_id).to("cuda")
@@ -168,5 +168,5 @@ gr.Interface(
168
  fn=process_image,
169
  inputs=gr.Image(type="pil"),
170
  outputs=[gr.Image(type="numpy"), gr.Image(type="numpy")],
171
- title="Insect Detection and Masking"
172
- ).launch()
 
112
  results = object_detector(image, candidate_labels=labels, threshold=threshold)
113
  return [DetectionResult.from_dict(result) for result in results]
114
 
115
+ @spaces.GGPU
116
  def segment(image: Image.Image, detection_results: List[DetectionResult], polygon_refinement: bool = False, segmenter_id: Optional[str] = None) -> List[DetectionResult]:
117
  segmenter_id = segmenter_id if segmenter_id else "martintmv/InsectSAM"
118
  segmentator = AutoModelForMaskGeneration.from_pretrained(segmenter_id).to("cuda")
 
168
  fn=process_image,
169
  inputs=gr.Image(type="pil"),
170
  outputs=[gr.Image(type="numpy"), gr.Image(type="numpy")],
171
+ title="🐞 Insect Detection and Masking"
172
+ ).launch()