Spaces:
Sleeping
Sleeping
Commit
·
470fd34
1
Parent(s):
3ed364c
Modifying the figures to be published
Browse files
app.py
CHANGED
@@ -318,8 +318,24 @@ for column in range(latent_dimensionality):
|
|
318 |
latent_matrix = np.array(latent_matrix).T # Transposes the matrix so that each row can be easily indexed
|
319 |
########################################################################################################################
|
320 |
# Plotting the Interpolation in 2D Using Chosen Points
|
321 |
-
if st.button("Generate Interpolation
|
322 |
plt.figure(2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
"""
|
324 |
plot_rows = 2
|
325 |
plot_columns = num_interp + 2
|
@@ -342,19 +358,6 @@ if st.button("Generate Interpolation:"):
|
|
342 |
# plt.title("Second Interpolation Point:\n" + str(box_shape_test[number_2]) + "\nPixel Density: " + str(
|
343 |
# box_density_test[number_2]) + "\nAdditional Pixels: " + str(additional_pixels_test[number_2])) # + "\nPredicted Latent Point 2: " + str(latent_point_2)
|
344 |
"""
|
345 |
-
linear_interp_latent = np.linspace(latent_point_1, latent_point_2, num_interp)
|
346 |
-
print(len(linear_interp_latent))
|
347 |
-
|
348 |
-
linear_predicted_interps = []
|
349 |
-
figure = np.zeros((28 * num_interp, 28))
|
350 |
-
for i in range(num_interp):
|
351 |
-
generated_image = decoder_model_boxes.predict(np.array([linear_interp_latent[i]]))[0]
|
352 |
-
figure[i * 28:(i + 1) * 28, 0:28, ] = generated_image[:, :, -1]
|
353 |
-
linear_predicted_interps.append(generated_image[:, :, -1])
|
354 |
-
|
355 |
-
plt.figure(figsize=(15, 15))
|
356 |
-
plt.imshow(figure, cmap='gray')
|
357 |
-
|
358 |
'''
|
359 |
latent_matrix_2 = [] # This will contain the latent points of the interpolation
|
360 |
for column in range(latent_dimensionality):
|
@@ -378,9 +381,7 @@ if st.button("Generate Interpolation:"):
|
|
378 |
generated_image = generator_model.predict(np.array([mesh[i][j]]))[0]
|
379 |
figure[i * 28:(i + 1) * 28, j * 28:(j + 1) * 28, ] = generated_image[:, :, -1]
|
380 |
mesh_predicted_interps.append(generated_image[:, :, -1])
|
381 |
-
|
382 |
plt.figure(figsize=(15, 15))
|
383 |
plt.imshow(figure, cmap='gray')
|
384 |
-
'''
|
385 |
-
plt.figure(2)
|
386 |
-
st.pyplot(plt.figure(2))
|
|
|
318 |
latent_matrix = np.array(latent_matrix).T # Transposes the matrix so that each row can be easily indexed
|
319 |
########################################################################################################################
|
320 |
# Plotting the Interpolation in 2D Using Chosen Points
|
321 |
+
if st.button("Generate Interpolation"):
|
322 |
plt.figure(2)
|
323 |
+
|
324 |
+
linear_interp_latent = np.linspace(latent_point_1, latent_point_2, num_interp)
|
325 |
+
print(len(linear_interp_latent))
|
326 |
+
|
327 |
+
linear_predicted_interps = []
|
328 |
+
figure = np.zeros((28 * num_interp, 28))
|
329 |
+
for i in range(num_interp):
|
330 |
+
generated_image = decoder_model_boxes.predict(np.array([linear_interp_latent[i]]))[0]
|
331 |
+
figure[i * 28:(i + 1) * 28, 0:28, ] = generated_image[:, :, -1]
|
332 |
+
linear_predicted_interps.append(generated_image[:, :, -1])
|
333 |
+
|
334 |
+
plt.figure(figsize=(15, 15))
|
335 |
+
# plt.imshow(figure, cmap='gray')
|
336 |
+
plt.figure(2)
|
337 |
+
st.pyplot(plt.figure(2))
|
338 |
+
|
339 |
"""
|
340 |
plot_rows = 2
|
341 |
plot_columns = num_interp + 2
|
|
|
358 |
# plt.title("Second Interpolation Point:\n" + str(box_shape_test[number_2]) + "\nPixel Density: " + str(
|
359 |
# box_density_test[number_2]) + "\nAdditional Pixels: " + str(additional_pixels_test[number_2])) # + "\nPredicted Latent Point 2: " + str(latent_point_2)
|
360 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
'''
|
362 |
latent_matrix_2 = [] # This will contain the latent points of the interpolation
|
363 |
for column in range(latent_dimensionality):
|
|
|
381 |
generated_image = generator_model.predict(np.array([mesh[i][j]]))[0]
|
382 |
figure[i * 28:(i + 1) * 28, j * 28:(j + 1) * 28, ] = generated_image[:, :, -1]
|
383 |
mesh_predicted_interps.append(generated_image[:, :, -1])
|
384 |
+
|
385 |
plt.figure(figsize=(15, 15))
|
386 |
plt.imshow(figure, cmap='gray')
|
387 |
+
'''
|
|
|
|