Spaces:
Runtime error
Runtime error
Commit
·
9b2570a
1
Parent(s):
aaaf8fc
Delete appy.py
Browse files
appy.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
| 1 |
-
def create_digit_samples(num_images):
|
| 2 |
-
random_latent_vectors = tf.random.normal(shape=(int(num_images), 128))
|
| 3 |
-
predictions = model.predict(random_latent_vectors)
|
| 4 |
-
num = ceil(sqrt(num_images))
|
| 5 |
-
digit_images = np.zeros((28*num, 28*num), dtype=float)
|
| 6 |
-
n = 0
|
| 7 |
-
for i in range(num):
|
| 8 |
-
for j in range(num):
|
| 9 |
-
if n == num_images:
|
| 10 |
-
break
|
| 11 |
-
digit_images[i* 28 : (i+1)*28, j*28 : (j+1)*28] = predictions[n, :, :, 0]
|
| 12 |
-
n += 1
|
| 13 |
-
return digit_images
|
| 14 |
-
|
| 15 |
-
title = "WGAN-GP"
|
| 16 |
-
description = "Image Generation Using WGAN"
|
| 17 |
-
article = """
|
| 18 |
-
<p style='text-align: center'>
|
| 19 |
-
<a href='https://keras.io/examples/generative/wgan_gp/' target='_blank'>Keras Example given by A_K_Nain</a>
|
| 20 |
-
<br>
|
| 21 |
-
Space by Gitesh Chawda
|
| 22 |
-
</p>
|
| 23 |
-
"""
|
| 24 |
-
inputs = gr.inputs.Number(label="number of images")
|
| 25 |
-
outputs = gr.outputs.Image(label="Predictions")
|
| 26 |
-
|
| 27 |
-
examples = [
|
| 28 |
-
[4],
|
| 29 |
-
[7],
|
| 30 |
-
[8],
|
| 31 |
-
[2],
|
| 32 |
-
[10]
|
| 33 |
-
]
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
gr.Interface(create_digit_samples, inputs, outputs, title=title, examples=examples, description=description, article=article, analytics_enabled=False).launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|