Update README.md
Browse files
README.md
CHANGED
@@ -16,6 +16,36 @@ Simple DCGAN implementation in TensorFlow to generate CryptoPunks.
|
|
16 |
|
17 |
Project repository: [CryptoGANs](https://github.com/dimitreOliveira/cryptogans).
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
## Training data
|
20 |
|
21 |
For training, I used the 10000 CryptoPunks images.
|
|
|
16 |
|
17 |
Project repository: [CryptoGANs](https://github.com/dimitreOliveira/cryptogans).
|
18 |
|
19 |
+
## Usage
|
20 |
+
|
21 |
+
You can play with the HuggingFace [space demo](https://huggingface.co/spaces/huggan/crypto-gan).
|
22 |
+
|
23 |
+
Or try it yourself
|
24 |
+
|
25 |
+
```python
|
26 |
+
import tensorflow as tf
|
27 |
+
import matplotlib.pyplot as plt
|
28 |
+
from huggingface_hub import from_pretrained_keras
|
29 |
+
|
30 |
+
seed = 42
|
31 |
+
n_images = 36
|
32 |
+
codings_size = 100
|
33 |
+
generator = from_pretrained_keras("huggan/crypto-gan")
|
34 |
+
|
35 |
+
def generate(generator, seed):
|
36 |
+
noise = tf.random.normal(shape=[n_images, codings_size], seed=seed)
|
37 |
+
generated_images = generator(noise, training=False)
|
38 |
+
|
39 |
+
fig = plt.figure(figsize=(10, 10))
|
40 |
+
for i in range(generated_images.shape[0]):
|
41 |
+
plt.subplot(6, 6, i+1)
|
42 |
+
plt.imshow(generated_images[i, :, :, :])
|
43 |
+
plt.axis('off')
|
44 |
+
plt.savefig("samples.png")
|
45 |
+
|
46 |
+
generate(generator, seed)
|
47 |
+
```
|
48 |
+
|
49 |
## Training data
|
50 |
|
51 |
For training, I used the 10000 CryptoPunks images.
|