Spaces:
Running
Running
Update pages/23_GANs.py
Browse files- pages/23_GANs.py +4 -2
pages/23_GANs.py
CHANGED
@@ -45,7 +45,6 @@ latent_dim = 100
|
|
45 |
image_dim = 28 * 28 # MNIST images are 28x28 pixels
|
46 |
lr = 0.0002
|
47 |
batch_size = 64
|
48 |
-
epochs = 50
|
49 |
|
50 |
# Prepare the data
|
51 |
transform = transforms.Compose([
|
@@ -71,6 +70,9 @@ criterion = nn.BCELoss()
|
|
71 |
st.title("GAN with PyTorch and Hugging Face")
|
72 |
st.write("Training a GAN to generate MNIST digits")
|
73 |
|
|
|
|
|
|
|
74 |
train_gan = st.button("Train GAN")
|
75 |
|
76 |
if train_gan:
|
@@ -111,4 +113,4 @@ if train_gan:
|
|
111 |
ax.imshow(np.squeeze(grid), cmap="gray")
|
112 |
st.pyplot(fig)
|
113 |
else:
|
114 |
-
st.write("
|
|
|
45 |
image_dim = 28 * 28 # MNIST images are 28x28 pixels
|
46 |
lr = 0.0002
|
47 |
batch_size = 64
|
|
|
48 |
|
49 |
# Prepare the data
|
50 |
transform = transforms.Compose([
|
|
|
70 |
st.title("GAN with PyTorch and Hugging Face")
|
71 |
st.write("Training a GAN to generate MNIST digits")
|
72 |
|
73 |
+
# Slider for epochs
|
74 |
+
epochs = st.slider("Number of Epochs", min_value=1, max_value=100, value=50)
|
75 |
+
|
76 |
train_gan = st.button("Train GAN")
|
77 |
|
78 |
if train_gan:
|
|
|
113 |
ax.imshow(np.squeeze(grid), cmap="gray")
|
114 |
st.pyplot(fig)
|
115 |
else:
|
116 |
+
st.write("Use the slider to select the number of epochs and click the button to start training the GAN")
|