Ercik's picture
Update app.py
68fa3bf
raw
history blame
862 Bytes
import streamlit as st
import tensorflow as tf
import keras
import numpy as np
from PIL import Image
# Load the model
model = tf.keras.models.load_model("/content/modelo_celeba_50e.h5", compile=False)
# Create a title
st.title("Clasificador de imágenes de CelebA")
# Add a button to upload an image
uploaded_image = st.file_uploader("Cargar imagen")
# If an image is uploaded, process it
if uploaded_image is not None:
# Convert the uploaded file to a PIL Image object
image = Image.open('/content/Uriel_foto.png').convert('RGB')
image = image.resize((178,218))
# Convert the PIL Image object to a NumPy array
image = np.array(image)/255.0
image = np.expand_dims(image,axis=0)
# Make a prediction
prediction = model.predict(image)
# Display the prediction
st.write("La predicción es:")
st.write(prediction)