| |
|
| | import torch |
| | import cv2 |
| | import gradio as gr |
| | from ultralytics import YOLO |
| | import numpy as np |
| | from huggingface_hub import hf_hub_download |
| |
|
| | |
| | model_path = hf_hub_download(repo_id="At0lla/Muraka_ai", filename="best.pt") |
| | model = YOLO(model_path) |
| |
|
| | |
| | def detect_objects(image, confidence_threshold): |
| | results = model(image, conf=confidence_threshold) |
| | annotated_frame = results[0].plot() |
| | return annotated_frame |
| |
|
| | |
| | gr.Interface( |
| | fn=detect_objects, |
| | inputs=[ |
| | gr.Image(type="numpy", label="Upload Coral Image"), |
| | gr.Slider(0.0, 1.0, value=0.25, label="Confidence Threshold", |
| | info="Lower = more sensitive, Higher = fewer false positives") |
| | ], |
| | outputs=gr.Image(type="numpy", label="Analysis Results"), |
| | title="🪸 Muraka - AI Doctor for Corals", |
| | description="Upload coral images to assess health status. Adjust confidence threshold to control detection sensitivity.", |
| | allow_flagging="never" |
| | ).launch() |
| |
|