timothytampold commited on
Commit
4e42555
·
1 Parent(s): c41b980

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -1,7 +1,21 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from transformers import AutoFeatureExtractor, AutoModelForImageGeneration
3
 
4
+ feature_extractor = AutoFeatureExtractor.from_pretrained("akhaliq/Stylegan-ffhq-vintage")
5
+ model = AutoModelForImageGeneration.from_pretrained("akhaliq/Stylegan-ffhq-vintage")
6
 
7
+ def generate_image(seed):
8
+ inputs = feature_extractor(seed, return_tensors="pt")
9
+ with torch.no_grad():
10
+ images = model.generate(**inputs)
11
+ return images[0]
12
+
13
+ iface = gr.Interface(
14
+ fn=generate_image,
15
+ inputs=gr.inputs.Textbox(label="Input Seed for Generation"),
16
+ outputs="image",
17
+ title="StyleGAN3 Image Generator",
18
+ description="Enter a seed to generate a new image with StyleGAN3."
19
+ )
20
+
21
+ iface.launch()