Spaces:
Sleeping
Sleeping
| import json | |
| from keras.models import Model, load_model | |
| import gradio as gr | |
| import cv2 | |
| import numpy as np | |
| model = load_model('final_vgg1920epochs.h5', compile=True) | |
| # Opening JSON file | |
| f = open('dat.json') | |
| # returns JSON object as | |
| # a dictionary | |
| data = json.load(f) | |
| keys = list(data) | |
| def Predict(image): | |
| img = cv2.resize(image, (32,32)) / 255.0 | |
| prediction = model.predict(img.reshape(1,32,32,3)) | |
| print(prediction) | |
| return keys[prediction.argmax()],data[keys[prediction.argmax()]]['description'],data[keys[prediction.argmax()]]['symptoms'],data[keys[prediction.argmax()]]['causes'],data[keys[prediction.argmax()]]['treatement-1'] | |
| demo=gr.Interface(fn=Predict, | |
| inputs="image", | |
| outputs=[gr.inputs.Textbox(label='Name Of Disease'),gr.inputs.Textbox(label='Description'),gr.inputs.Textbox(label='Symptoms'),gr.inputs.Textbox(label='Causes'),gr.inputs.Textbox(label='Treatement')], | |
| title="Predict Skin Disease") | |
| demo.launch(debug=True) |