professorbrat's picture
Update app.py
a69b26a
raw
history blame contribute delete
No virus
690 Bytes
import tensorflow as tf
import numpy as np
nomanet = tf.keras.models.load_model("Nomanet.h5")
import gradio as gr
labels = {0: "melanoma", 1: "nevus", 2: "seborrheic_keratosis"}
def classify_image(inp):
image_array = tf.keras.preprocessing.image.img_to_array(
tf.keras.preprocessing.image.load_img(inp, target_size=(256,256)))
image_array_with_batchdim = image_array[np.newaxis, :]
model_prediction = np.argmax(nomanet.predict(image_array_with_batchdim), axis=-1)[0]
return labels[model_prediction]
gr.Interface(fn=classify_image,
inputs=gr.inputs.Image(type="filepath"),
outputs=gr.outputs.Label()).launch()