alibidaran commited on
Commit
6dc08e9
1 Parent(s): b1bd035

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+ from PIL import Image
3
+ onn_xmodel=YOLO("/content/best.onnx")
4
+ import gradio as gr
5
+ def detect_fraction(image):
6
+ results=onn_xmodel.predict([image],stream=False,imgsz=512)
7
+ #results
8
+ res=results[0].plot()
9
+ return Image.fromarray(res)
10
+
11
+
12
+ demo=gr.Interface(fn=detect_fraction,inputs=gr.Image(type='pil',label='Upload your XRAY'),
13
+ outputs=gr.Image(type='pil',label='Results'),
14
+ examples=['image1_0_png.rf.99862308d714bff3f9c410adf5ca93ac.jpg',
15
+ 'image1_1035_png.rf.d7493a5653bc3628f7a1b1ec0eb5de85.jpg',
16
+ 'image1_1015_png.rf.3b7320c3c40771fa5532bf713a728b83.jpg',
17
+ 'image1_1084_png.rf.d9da08b77872f6b4282f2700d216b9b3.jpg',
18
+ 'image1_1311_png.rf.27646e931562cc3823c79f79472b8749.jpg',
19
+ 'image1_145_png.rf.a69d928d011a93d25a95b7b8380ea25d.jpg'],
20
+ #themes=gr.themes.Soft(primary_hue=gr.themes.colors.amber,secondary_hue=gr.themes.colors.blue),
21
+ title="Detecting bone fractions")
22
+ if __name__=="__main__":
23
+ demo.launch(debug=True)