abd / app.py
abdabbas's picture
xxx (#1)
8b8f5a0
raw
history blame
No virus
463 Bytes
def predict_image(img):
img_4d=img.reshape(-1,299,299,3)
img_4d=img_4d/255
prediction=model.predict(img_4d)[0]
#prediction = [1 if x>0.5 else 0 for x in prediction]
return {class_names[i]: float(prediction[i]) for i in range(1)}
import gradio as gr
image = gr.inputs.Image(shape=(299,299))
label = gr.outputs.Label(num_top_classes=1)
gr.Interface(fn=predict_image, inputs=image,
outputs=label).launch(debug='False',share=True)