import os import gradio as gr from PIL import Image os.system("git clone https://github.com/autonomousvision/projected_gan") os.chdir("projected_gan") os.mkdir("outputs") os.system("gdown --id '1H-MYFZqngF1R0whm4bc3fEoX7VvOWaDl'") def inference(truncation,seeds): os.system("python gen_images.py --outdir=./outputs/ --trunc="+str(truncation)+" --seeds="+str(int(seeds))+" --network=network-snapshot-metfaces2.pkl") seeds = int(seeds) image = Image.open(f"./outputs/seed{seeds:04d}.png") return image title = "Projected GAN" description = "Gradio demo for Projected GAN. To use it, add seed and truncation, or click one of the examples to load them. Read more at the links below." article = "

Projected GANs Converge Faster | Github Repo

visitor badge
" gr.Interface(inference,[gr.inputs.Slider(label="truncation",minimum=0, maximum=5, step=0.1, default=0.8),gr.inputs.Slider(label="Seed",minimum=0, maximum=1000, step=1, default=0)],"pil",title=title,description=description,article=article, examples=[ [0.8,0] ]).launch(enable_queue=True,cache_examples=True)