Spaces:
Runtime error
Runtime error
Commit
·
4e42555
1
Parent(s):
c41b980
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,21 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|