Update app.py
Browse files
app.py
CHANGED
|
@@ -191,7 +191,7 @@ elif selected == 'Projects':
|
|
| 191 |
st.image(model_out(imgs[1],'Portfolio Projects/photo2monet2.h5'),use_column_width=False)
|
| 192 |
|
| 193 |
if selected_option == 'Pix2Pix':
|
| 194 |
-
imgs = img_prep(['
|
| 195 |
col1,col2 = st.columns(2)
|
| 196 |
with col1:
|
| 197 |
st.image(imgs[0],use_column_width=False)
|
|
@@ -201,9 +201,26 @@ elif selected == 'Projects':
|
|
| 201 |
img_options = {'img1':1, 'img2':2}
|
| 202 |
img_selected_option = st.selectbox('Select an Image', img_options)
|
| 203 |
if img_selected_option == 'img1':
|
| 204 |
-
st.image(model_out(imgs[0],'Portfolio Projects/
|
| 205 |
if img_selected_option == 'img2':
|
| 206 |
-
st.image(model_out(imgs[1],'Portfolio Projects/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
st.write('You selected:', selected_option)
|
| 209 |
else:
|
|
|
|
| 191 |
st.image(model_out(imgs[1],'Portfolio Projects/photo2monet2.h5'),use_column_width=False)
|
| 192 |
|
| 193 |
if selected_option == 'Pix2Pix':
|
| 194 |
+
imgs = img_prep(['pp1.jpg','pp2.jpg'])
|
| 195 |
col1,col2 = st.columns(2)
|
| 196 |
with col1:
|
| 197 |
st.image(imgs[0],use_column_width=False)
|
|
|
|
| 201 |
img_options = {'img1':1, 'img2':2}
|
| 202 |
img_selected_option = st.selectbox('Select an Image', img_options)
|
| 203 |
if img_selected_option == 'img1':
|
| 204 |
+
st.image(model_out(imgs[0],'Portfolio Projects/FaceWithMask.h5'),use_column_width=False)
|
| 205 |
if img_selected_option == 'img2':
|
| 206 |
+
st.image(model_out(imgs[1],'Portfolio Projects/FaceWithMask.h5'),use_column_width=False)
|
| 207 |
+
|
| 208 |
+
if selected_option == 'DCGAN':
|
| 209 |
+
model = tf.keras.models.load_model('doggen3.h5')
|
| 210 |
+
|
| 211 |
+
# Create a button
|
| 212 |
+
button_clicked = st.button("Generate")
|
| 213 |
+
|
| 214 |
+
# Check if the button is clicked
|
| 215 |
+
if button_clicked:
|
| 216 |
+
# Generate an image
|
| 217 |
+
seed = tf.random.normal((1, 100))
|
| 218 |
+
pred = model.predict(seed)
|
| 219 |
+
pred = pred * 0.5 + 0.5 # Normalize the pixel values
|
| 220 |
+
pred = np.squeeze(pred) # Remove singleton dimensions if any
|
| 221 |
+
|
| 222 |
+
# Display the generated image
|
| 223 |
+
st.image(pred, caption='Generated Image', use_column_width=True)
|
| 224 |
|
| 225 |
st.write('You selected:', selected_option)
|
| 226 |
else:
|