Spaces:
Runtime error
Runtime error
File size: 858 Bytes
83e45f7 a6b1be8 f8a7901 83e45f7 ed4fbc0 f8a7901 4aa0abc f8a7901 183a745 047136e 4aa0abc f8a7901 ed4fbc0 9758eda 1cee841 c801b0d e1e19d4 183a745 f8a7901 047136e e1e19d4 f8a7901 aa3a32e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import gradio as gr
import tensorflow as tf
import matplotlib.pyplot as plt
from huggingface_hub import from_pretrained_keras
n_images = 36
codings_size = 100
generator = from_pretrained_keras("huggan/crypto-gan")
def generate(seed):
noise = tf.random.normal(shape=[n_images, codings_size], seed=seed)
generated_images = generator(noise, training=False)
fig = plt.figure(figsize=(10, 10))
for i in range(generated_images.shape[0]):
plt.subplot(6, 6, i+1)
plt.imshow(generated_images[i, :, :, :])
plt.axis("off")
plt.savefig('foo.png')
return "foo.png"
gr.Interface(fn=generate,
inputs=[gr.inputs.Slider(label='Seed', minimum=0, maximum=1000, default=42)],
outputs=gr.Image(),
title="CryptoGAN",
description="These CryptoPunks do not exist.").launch() |