Spaces:
Runtime error
Runtime error
File size: 939 Bytes
8d9bce5 cb92cf8 8d9bce5 f61ff98 437deab 8d9bce5 2dca684 8d9bce5 f86f9d4 8d9bce5 ca93fdc f86f9d4 5988d6c f61ff98 8d9bce5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import tensorflow as tf
import gradio as gr
import numpy as np
modelo =tf.keras.models.load_model('model_0.h5')
#modelo.load_weights("model_0_weights.h5")
classes=['daisy','dandelion','roses','sunflowers','tulips']
def classifier(image):
pred_img = modelo.predict(tf.expand_dims(image,axis=0))
pred_img = tf.squeeze(tf.round(pred_img))
texto = str(f'Predicted label: {classes[(np.argmax(pred_img))]}!!!')
return texto
interface = gr.Interface(classifier,gr.inputs.Image(shape=(180,180)),outputs = "text",
description="Classifier of images of daisy plants, dandelion, roses, sunflowers, and tulips",
title="Flower Image Classifier",
examples=[['1022552036_67d33d5bd8_n.jpg'],['142218310_d06005030a_n.jpg'],
['2077865117_9ed85191ae_n.jpg'],['3500121696_5b6a69effb_n.jpg'],['4675287055_5938ed62c4.jpg']])
interface.launch()
|