Spaces:
Runtime error
Runtime error
Download app.py from Beasto/Pokemon_Image_Generator_GAN: direct link, hf CLI and curl.
- Browser
- Download file 578 Bytes
-
https://huggingface.co/spaces/Beasto/Pokemon_Image_Generator_GAN/resolve/main/app.py
- Command line
-
hf download hf://spaces/Beasto/Pokemon_Image_Generator_GAN/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Beasto/Pokemon_Image_Generator_GAN/resolve/main/app.py
578 Bytes
| import streamlit as st | |
| import tensorflow as tf | |
| import numpy as np | |
| # Load the model | |
| model = tf.keras.models.load_model('pokemongenerator.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) |