File size: 587 Bytes
e053588
 
ae611ab
e053588
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c3e7cdd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()