test9 / app.py
yupikopi's picture
Update app.py
acd98e9
raw
history blame
820 Bytes
from tensorflow.keras.models import load_model
import gradio as gr
from PIL import Image
import numpy as np
model = load_model('Pikachu_and_Raichu.h5')
class_names = ['Pikachu', 'Raichu']
def predict(img):
img=img.reshape(160,160,3)
"""images_list = []
images_list.append(np.array(img))
x = np.asarray(images_list)"""
prediction = model.predict(img)[0]
return {class_names[i]: float(prediction[i]) for i in range(len(class_names))}
image = gr.inputs.Image(shape=(160, 160))
label = gr.outputs.Label(num_top_classes=2)
gr.Interface(fn=predict, inputs=image, title="Garbage Classifier",
description="This is a Garbage Classification Model Trained using Dataset 11 by Sud.Deployed to Hugging Faces using Gradio.",outputs=label,interpretation='default').launch(debug=True,enable_queue=True)