import gradio as gr from keras.models import load_model import cv2 import numpy as np model = load_model('covid_trained_model.h5') def sigmoid_to_binary(output_value, threshold=0.705): if output_value >= threshold: return 1 else: return 0 def covid(img): resized_image = cv2.resize(img, (224, 224)) reshaped_image = np.expand_dims(resized_image, axis=0) pred = model.predict(reshaped_image) binary = sigmoid_to_binary(pred[0,0]) if(binary == 0): return "COVID POSITIVE +" return "COVID NEGATIVE -" gr.Interface(fn=covid,inputs="image",outputs="text",title="Covid19 Detector by CHEST X-Ray",description="Please upload your CHEST X-RAY in below input field").launch()