Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,22 +5,22 @@ from ultralytics.utils.plotting import Annotator
|
|
5 |
|
6 |
import gradio as gr
|
7 |
|
8 |
-
cell_detector = YOLO("./weights/
|
9 |
-
redetr_detector = YOLO("./weights/redetr_infected_cells.pt")
|
10 |
yolo_detector = YOLO("./weights/yolo_infected_cells.pt")
|
|
|
11 |
|
12 |
-
models = {"Yolo V11": yolo_detector, "Real Time Detection Transformer":
|
13 |
-
classes = {"Yolo V11": [0], "Real Time Detection Transformer": [1]}
|
14 |
|
15 |
|
16 |
-
def inference(image, model) -> Tuple[str, str, str]:
|
17 |
bboxes = []
|
18 |
labels = []
|
19 |
healthy_cell_count = 0
|
20 |
unhealthy_cell_count = 0
|
21 |
-
cells_results = cell_detector.predict(image, conf=0.
|
22 |
selected_model_results = models[model].predict(
|
23 |
-
image, conf=
|
24 |
)
|
25 |
|
26 |
for cell_result in cells_results:
|
@@ -53,6 +53,7 @@ ifer = gr.Interface(
|
|
53 |
gr.Dropdown(
|
54 |
choices=["Yolo V11", "Real Time Detection Transformer"], multiselect=False
|
55 |
),
|
|
|
56 |
],
|
57 |
outputs=[
|
58 |
gr.Image(label="Output Image", type="numpy"),
|
@@ -62,4 +63,4 @@ ifer = gr.Interface(
|
|
62 |
title="Blood Cancer Cell Detection and Counting"
|
63 |
)
|
64 |
|
65 |
-
ifer.launch(share=True)
|
|
|
5 |
|
6 |
import gradio as gr
|
7 |
|
8 |
+
cell_detector = YOLO("./weights/yolo_uninfected_cell.pt")
|
|
|
9 |
yolo_detector = YOLO("./weights/yolo_infected_cells.pt")
|
10 |
+
# redetr_detector = YOLO("./weights/yolo_infected_cells.pt")
|
11 |
|
12 |
+
models = {"Yolo V11": yolo_detector, "Real Time Detection Transformer": yolo_detector}
|
13 |
+
# classes = {"Yolo V11": [0], "Real Time Detection Transformer": [1]}
|
14 |
|
15 |
|
16 |
+
def inference(image, model, conf) -> Tuple[str, str, str]:
|
17 |
bboxes = []
|
18 |
labels = []
|
19 |
healthy_cell_count = 0
|
20 |
unhealthy_cell_count = 0
|
21 |
+
cells_results = cell_detector.predict(image, conf=0.4)
|
22 |
selected_model_results = models[model].predict(
|
23 |
+
image, conf=conf
|
24 |
)
|
25 |
|
26 |
for cell_result in cells_results:
|
|
|
53 |
gr.Dropdown(
|
54 |
choices=["Yolo V11", "Real Time Detection Transformer"], multiselect=False
|
55 |
),
|
56 |
+
gr.Slider(minimum=0.01, maximum=1)
|
57 |
],
|
58 |
outputs=[
|
59 |
gr.Image(label="Output Image", type="numpy"),
|
|
|
63 |
title="Blood Cancer Cell Detection and Counting"
|
64 |
)
|
65 |
|
66 |
+
ifer.launch(share=True)
|