Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from tensorflow import keras | |
| from skimage.transform import resize | |
| # def greet(name): | |
| # return "Hello " + name + "!!" | |
| # iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| # iface.launch() | |
| resnet50_model = keras.models.load_model('model.h5') | |
| labels = ['Glaucoma_Pos', 'Glaucoma_Neg'] | |
| def classify_image(inp): | |
| inp =resize(inp, (300, 300, 3)) | |
| inp = inp.reshape((-1, 300, 300, 3)) | |
| # inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp) | |
| prediction = resnet50_model.predict(inp).flatten() | |
| confidences = {labels[i]: float(prediction[i]) for i in range(2)} | |
| return confidences | |
| gr.Interface(fn=classify_image, | |
| inputs=gr.Image(shape=(300, 300)), | |
| outputs=gr.Label(num_top_classes=2), | |
| ).launch() |