Spaces:
Sleeping
Sleeping
File size: 548 Bytes
5a7c1e3 d42a190 5a7c1e3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from tensorflow import keras
import gradio as gr
model = keras.models.load_model('B_or_NOT.h5')
class_names = ['Biodegradable', 'Non_Biodegradable']
def predict_input_image(img):
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(len(class_names))}
image = gr.inputs.Image(shape=(224,224))
label = gr.outputs.Label(num_top_classes=len(class_names))
gr.Interface(fn=predict_input_image, inputs=image, outputs=label,interpretation='default').launch(debug='True') |