Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import tensorflow as tf
|
3 |
+
import numpy as np
|
4 |
+
|
5 |
+
# Load the model
|
6 |
+
model = tf.keras.models.load_model('HumanFaceGenerator.h5')
|
7 |
+
|
8 |
+
# Create a button
|
9 |
+
button_clicked = st.button("Generate")
|
10 |
+
|
11 |
+
# Check if the button is clicked
|
12 |
+
if button_clicked:
|
13 |
+
# Generate an image
|
14 |
+
seed = tf.random.normal((1, 100))
|
15 |
+
pred = model.predict(seed)
|
16 |
+
pred = pred * 0.5 + 0.5 # Normalize the pixel values
|
17 |
+
pred = np.squeeze(pred) # Remove singleton dimensions if any
|
18 |
+
|
19 |
+
# Display the generated image
|
20 |
+
st.image(pred, caption='Generated Image', use_column_width=True)
|