Spaces:
Build error
Build error
from tensorflow.keras.models import load_model | |
import gradio as gr | |
import PIL.Image as Image | |
import numpy as np | |
model = load_model('DS11Sudhanva.h5') | |
classnames = ['cardboard', 'metal','paper','plastic','trash','green-glass','white-glass','brown-glass','clothes','biological','battery','shoes'] | |
def predict(img): | |
img=img.reshape(-1,298, 384,3) | |
prediction = model.predict(img[0]) | |
return {classnames[i]: float(prediction[i]) for i in range(len(classnames))} | |
image = gr.inputs.Image(shape=(298, 384)) | |
label = gr.outputs.Label(num_top_classes=3) | |
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) | |