Spaces:
Running
Running
import gradio as gr | |
import numpy as np | |
import pandas as pd | |
import keras | |
import tensorflow as tf | |
sep_model = keras.models.load_model("goodmodel.h5") | |
def process(input_img): | |
list_form = np.array([input_img]) | |
print(list_form.shape) | |
results = sep_model.predict([list_form]) | |
results = list(results[0]) | |
print(results) | |
classification = "" | |
if results[0] > results[1] and results[0] > results[2]: | |
classification = "Benign" | |
elif results[1] > results[0] and results[1] > results[2]: | |
classification = "Malignant" | |
else: | |
classification = "Non-neoplastic" | |
print(classification) | |
return classification | |
demo = gr.Interface(process, gr.Image(shape=(240, 240)), "text", | |
title="Optimized Image Classification Models on Dark Skin Lesions", | |
description="Images that are not of skin lesions will throw off the model, as it will try to classify all images within the three categories (benign, malignant, non-neoplastic). \n 1. Take photo of the lesion (or click on an example image) \n 2. Click Submit \n 3. Result. ", | |
examples=[ | |
["examples/b1.jpeg"], | |
["examples/b2.jpeg"], | |
["examples/m1.jpeg"], | |
["examples/m2.jpeg"], | |
["examples/nn1.jpeg"], | |
["examples/nn2.jpeg"] | |
], | |
interpretation=None | |
) | |
demo.launch() |