Spaces:
Runtime error
Runtime error
File size: 1,018 Bytes
6e532dc bffb338 f51b773 4c82b05 bffb338 4c82b05 019b686 bffb338 6e532dc bffb338 6e532dc 4c82b05 6e532dc bffb338 6e532dc bffb338 6e532dc bffb338 6e532dc 4c82b05 39702b6 bffb338 4c82b05 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # import tensorflow
# from keras.models import model_from_json
import gradio as gr
import tensorflow
import pickle
import os
import tensorflow as tf
from tensorflow import keras
#Agregar red neuronal, función q la importe desde la carpeta creada
model = tf.keras.models.load_model('model')
image_size = 250
def predict_image(img):
img_4d=img.reshape(-1,image_size,image_size,3)
prediction=model.predict(img_4d, verbose=0)[0]
print(prediction)
return {"Victoria": float(prediction[i]) for i in range(1)}
image = gr.inputs.Image(shape=(image_size,image_size))
label = gr.outputs.Label(num_top_classes=1)
sample_images = []
base_dir = './examples/'
for file in os.listdir(base_dir):
if file == ".git" or file == ".ipynb_checkpoints":
continue
sample_images.append(base_dir + '/' + file)
iface = gr.Interface(fn=predict_image,
inputs=image,
outputs=label,
title="Self Facial Recognition",
examples=sample_images)
iface.launch() |