Update app.py
Browse files2 unmodified lines3456789101112131415162 unmodified linesdef gradio_predict(image):with open(image, "rb") as f:return predict(f.read())iface = gr.Interface(fn=gradio_predict,inputs=gr.Image(type="filepath"),outputs=gr.JSON(label="Prediction"))if __name__ == "__main__":iface.launch()2 unmodified lines345678910111213141516172 unmodified linesdef gradio_predict(image):with open(image, "rb") as f:result = predict(f.read()) # returns {"class": "meningioma", "confidence": 0.97}return {result["class"]: float(result["confidence"])} # Gradio Label expects {label: confidence}iface = gr.Interface(fn=gradio_predict,inputs=gr.Image(type="filepath", label="Upload MRI Image"),outputs=gr.Label(num_top_classes=1, label="Prediction"),title="Brain Tumor MRI Image Classification")if __name__ == "__main__":iface.launch()
app.py+5-4