File size: 677 Bytes
c41b980
b1087a6
c41b980
4e42555
b1087a6
c41b980
4e42555
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import AutoFeatureExtractor, TFAutoModel

feature_extractor = AutoFeatureExtractor.from_pretrained("akhaliq/Stylegan-ffhq-vintage")
model = TFAutoModel.from_pretrained("akhaliq/Stylegan-ffhq-vintage")

def generate_image(seed):
    inputs = feature_extractor(seed, return_tensors="pt")
    with torch.no_grad():
        images = model.generate(**inputs)
    return images[0]
    
iface = gr.Interface(
    fn=generate_image,
    inputs=gr.inputs.Textbox(label="Input Seed for Generation"),
    outputs="image",
    title="StyleGAN3 Image Generator",
    description="Enter a seed to generate a new image with StyleGAN3."
)

iface.launch()