ma4389 commited on
Commit
274d88d
·
verified ·
1 Parent(s): f426032

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +24 -0
  2. best.pt +3 -0
  3. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from ultralytics import YOLO
3
+ import cv2
4
+
5
+ # Load your YOLOv8 model
6
+ model = YOLO("best.pt")
7
+
8
+ # Prediction function
9
+ def detect_fracture(image):
10
+ results = model.predict(source=image, save=False) # Run inference
11
+ annotated_img = results[0].plot() # Draw detections
12
+ return annotated_img
13
+
14
+ # Gradio interface
15
+ demo = gr.Interface(
16
+ fn=detect_fracture,
17
+ inputs=gr.Image(type="numpy", label="Upload Bone X-ray"),
18
+ outputs=gr.Image(type="numpy", label="Detection Result"),
19
+ title="Human Bone Fracture Detection",
20
+ description="Upload an X-ray image to detect types of human bone fractures using YOLOv8."
21
+ )
22
+
23
+ if __name__ == "__main__":
24
+ demo.launch(debug=True)
best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:855d4ed37ed87ac62632d2d826a468474e4e380cfdbdab26bdc1916c98ea224a
3
+ size 6251939
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio==4.29.0
2
+ ultralytics==8.2.53
3
+ opencv-python==4.9.0.80
4
+ torch>=2.0.0