sl1 / app.py
dronursevli's picture
Create app.py
0e6eb25 verified
raw
history blame contribute delete
606 Bytes
import gradio as gr
import tensorflow as tf
from PIL import Image, ImageOps # Install pillow instead of PIL
import numpy as np
#%%
class_names={0:"iyi huylu",1:"melanoma"}
def predict_input_image(img):
#teachable machine ile eğitip kaydettiğim model
model = tf.keras.models.load_model('keras_model.h5')
img_4d=img.reshape(-1,224,224,3)
prediction=model.predict(img_4d)[0]
return {class_names[i]: float(prediction[i]) for i in range(2)}
image = gr.Image()
label = gr.Label(num_top_classes=4)
gr.Interface(fn=predict_input_image, inputs=image, outputs=label).launch(debug='True')