File size: 774 Bytes
84f7796
1f661f5
84f7796
 
1f661f5
84f7796
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import matplotlib.pyplot as plt

from huggingface_hub import from_pretrained_keras
seed = gr.inputs.Slider(step = 1)
number_of_examples = gr.inputs.Slider(minimum = 1, maximum = 4, step = 1)
image = gr.outputs.Image(type = "plot")

model = from_pretrained_keras("merve/anime-faces-generator")
def generate_and_save_images(seed, number_of_examples):
  
  seed = tf.random.normal([number_of_examples, seed])
  predictions = model(test_input, training=False)

  fig = plt.figure(figsize=(16, 64))

  for i in range(predictions.shape[0]):
      plt.subplot(1, 4, i+1)
      plt.imshow(predictions[i, :, :, :])
      plt.axis('off')
  return plt



gr.Interface(generate_and_save_image, inputs = [seed, number_of_examples], outputs = image).launch(debug=True)