Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import tensorflow as tf | |
| import cv2 | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import requests | |
| def predict_img(img): | |
| image = np.array(img) / 255.0 | |
| # new_model = tf.keras.models.load_model("https://huggingface.co/khushpreet/eyedisease/blob/main/64x3-CNN.model/saved_model.pb") | |
| proxies = {"http": "https://huggingface.co/spaces/khushpreet/diseasedetection/tree/main/64x3-CNN.model"} | |
| new_model = AutoModelForSequenceClassification.from_pretrained(proxies) | |
| predict=new_model.predict(np.array([image])) | |
| per=np.argmax(predict,axis=1) | |
| if per==1: | |
| return "No Diabetic" | |
| else: | |
| return "Diabetic" | |
| image = gr.inputs.Image(shape=(224,224)) | |
| gr.Interface(fn=predict_img, inputs=image, outputs="text",interpretation='default').launch(debug='false') | |