Spaces:
Running
Running
Martin Tomov
commited on
Commit
β’
a0bd560
1
Parent(s):
850cda3
gsl_result app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
try:
|
2 |
import detectron2
|
3 |
except:
|
4 |
-
import os
|
5 |
os.system('pip install git+https://github.com/facebookresearch/detectron2.git')
|
6 |
|
7 |
import gradio as gr
|
@@ -10,12 +10,15 @@ import numpy as np
|
|
10 |
from sam_utils import grounded_segmentation, create_yellow_background_with_insects
|
11 |
from yolo_utils import yolo_processimage
|
12 |
from detectron_utils import detectron_process_image
|
|
|
|
|
13 |
def process_image(image, include_json):
|
14 |
-
detectron_result=detectron_process_image(image)
|
15 |
yolo_result = yolo_processimage(image)
|
16 |
insectsam_result = create_yellow_background_with_insects(image)
|
|
|
17 |
|
18 |
-
return insectsam_result, yolo_result, detectron_result
|
19 |
|
20 |
examples = [
|
21 |
["demo.jpg"],
|
@@ -29,9 +32,12 @@ examples = [
|
|
29 |
gr.Interface(
|
30 |
fn=process_image,
|
31 |
inputs=[gr.Image(type="pil")],
|
32 |
-
outputs=[
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
35 |
title="Insect Model Zoo ππ¬",
|
36 |
examples=examples
|
37 |
).launch()
|
|
|
1 |
try:
|
2 |
import detectron2
|
3 |
except:
|
4 |
+
import os
|
5 |
os.system('pip install git+https://github.com/facebookresearch/detectron2.git')
|
6 |
|
7 |
import gradio as gr
|
|
|
10 |
from sam_utils import grounded_segmentation, create_yellow_background_with_insects
|
11 |
from yolo_utils import yolo_processimage
|
12 |
from detectron_utils import detectron_process_image
|
13 |
+
from gsl_utils import gsl_process_image
|
14 |
+
|
15 |
def process_image(image, include_json):
|
16 |
+
detectron_result = detectron_process_image(image)
|
17 |
yolo_result = yolo_processimage(image)
|
18 |
insectsam_result = create_yellow_background_with_insects(image)
|
19 |
+
gsl_result = gsl_process_image(image)
|
20 |
|
21 |
+
return insectsam_result, yolo_result, detectron_result, gsl_result
|
22 |
|
23 |
examples = [
|
24 |
["demo.jpg"],
|
|
|
32 |
gr.Interface(
|
33 |
fn=process_image,
|
34 |
inputs=[gr.Image(type="pil")],
|
35 |
+
outputs=[
|
36 |
+
gr.Image(label='InsectSAM', type="numpy"),
|
37 |
+
gr.Image(label='Yolov8', type="numpy"),
|
38 |
+
gr.Image(label='Detectron', type="numpy"),
|
39 |
+
gr.Image(label='GSL', type="numpy")
|
40 |
+
],
|
41 |
title="Insect Model Zoo ππ¬",
|
42 |
examples=examples
|
43 |
).launch()
|