Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
|
| 2 |
import torch
|
| 3 |
import cv2
|
| 4 |
import gradio as gr
|
|
@@ -16,16 +15,20 @@ def detect_objects(image, confidence_threshold):
|
|
| 16 |
annotated_frame = results[0].plot()
|
| 17 |
return annotated_frame
|
| 18 |
|
| 19 |
-
# Create Gradio interface with slider
|
| 20 |
gr.Interface(
|
| 21 |
fn=detect_objects,
|
| 22 |
inputs=[
|
| 23 |
gr.Image(type="numpy", label="Upload Coral Image"),
|
| 24 |
gr.Slider(0.0, 1.0, value=0.25, label="Confidence Threshold",
|
| 25 |
-
|
| 26 |
],
|
| 27 |
outputs=gr.Image(type="numpy", label="Analysis Results"),
|
| 28 |
title="🪸 Muraka - AI Doctor for Corals",
|
| 29 |
description="Upload coral images to assess health status. Adjust confidence threshold to control detection sensitivity.",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
allow_flagging="never"
|
| 31 |
-
).launch()
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
import cv2
|
| 3 |
import gradio as gr
|
|
|
|
| 15 |
annotated_frame = results[0].plot()
|
| 16 |
return annotated_frame
|
| 17 |
|
| 18 |
+
# Create Gradio interface with slider and root-level examples
|
| 19 |
gr.Interface(
|
| 20 |
fn=detect_objects,
|
| 21 |
inputs=[
|
| 22 |
gr.Image(type="numpy", label="Upload Coral Image"),
|
| 23 |
gr.Slider(0.0, 1.0, value=0.25, label="Confidence Threshold",
|
| 24 |
+
info="Lower = more sensitive, Higher = fewer false positives")
|
| 25 |
],
|
| 26 |
outputs=gr.Image(type="numpy", label="Analysis Results"),
|
| 27 |
title="🪸 Muraka - AI Doctor for Corals",
|
| 28 |
description="Upload coral images to assess health status. Adjust confidence threshold to control detection sensitivity.",
|
| 29 |
+
examples=[
|
| 30 |
+
["band_disease.jpg", 0.25],
|
| 31 |
+
["bleached_coral_2.jpg", 0.25],
|
| 32 |
+
],
|
| 33 |
allow_flagging="never"
|
| 34 |
+
).launch()
|