Spaces:
Running
Running
import streamlit as st | |
import tensorflow as tf | |
import numpy as np | |
# Load the model | |
model = tf.keras.models.load_model('HumanFaceGenerator.h5') | |
# Create a button | |
button_clicked = st.button("Generate") | |
# Check if the button is clicked | |
if button_clicked: | |
# Generate an image | |
seed = tf.random.normal((1, 100)) | |
pred = model.predict(seed) | |
pred = pred * 0.5 + 0.5 # Normalize the pixel values | |
pred = np.squeeze(pred) # Remove singleton dimensions if any | |
# Display the generated image | |
st.image(pred, caption='Generated Image', use_column_width=True) |