professorbrat's picture
Update app.py
c3e7cdd
raw
history blame
587 Bytes
import tensorflow as tf
nomanet = tf.keras.models.load_model("Nomanet.h5")
import gradio as gr
labels = {0: "melanoma", 1: "nevus", 2: "seborrheic_keratosis"}
def classify_image(inp):
img = tf.keras.utils.load_img(
inp, target_size=(256,256)
)
img_array = tf.keras.utils.img_to_array(img)
img_array = tf.expand_dims(img_array, 0)
predictions = nomanet.predict(img_array)[0]
return labels[model_prediction]
gr.Interface(fn=classify_image,
inputs=gr.inputs.Image(type="filepath"),
outputs=gr.outputs.Label()).launch()