Spaces:
Sleeping
Sleeping
from ultralytics import YOLO | |
from PIL import Image | |
onn_xmodel=YOLO("best.onnx") | |
import gradio as gr | |
def detect_fraction(image): | |
results=onn_xmodel.predict([image],stream=False,imgsz=512) | |
#results | |
res=results[0].plot() | |
return Image.fromarray(res) | |
demo=gr.Interface(fn=detect_fraction,inputs=gr.Image(type='pil',label='Upload your XRAY'), | |
outputs=gr.Image(type='pil',label='Results'), | |
examples=['image1_0_png.rf.99862308d714bff3f9c410adf5ca93ac.jpg', | |
'image1_1035_png.rf.d7493a5653bc3628f7a1b1ec0eb5de85.jpg', | |
'image1_1015_png.rf.3b7320c3c40771fa5532bf713a728b83.jpg', | |
'image1_1084_png.rf.d9da08b77872f6b4282f2700d216b9b3.jpg', | |
'image1_1311_png.rf.27646e931562cc3823c79f79472b8749.jpg', | |
'image1_145_png.rf.a69d928d011a93d25a95b7b8380ea25d.jpg'], | |
#themes=gr.themes.Soft(primary_hue=gr.themes.colors.amber,secondary_hue=gr.themes.colors.blue), | |
title="Detecting bone fractions") | |
if __name__=="__main__": | |
demo.launch(debug=True) |