Spaces:
Runtime error
Runtime error
File size: 696 Bytes
afd9fad b92b8d3 afd9fad b92b8d3 afd9fad |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import numpy as np
import gradio as gr
from roboflow import Roboflow
from PIL import Image
def obj(input_img):
#load model
rf = Roboflow(api_key="u5HA4Ou9LROqjjWJYSJV")
project = rf.workspace("modzie-work").project("bmd-result")
model = project.version(1).model
#save to .jpg
img = Image.fromarray(input_img, "RGB")
img.save("image_filename.jpg")
image_save_test = 'image_filename.jpg'
#predict
obj_result = model.predict(image_save_test, confidence=40, overlap=30).json()['predictions'][0]['class']
if obj_result == "Low Bone":
obj_result = "Osteopenia"
return obj_result
demo = gr.Interface(obj, "image", "text")
demo.launch() |