import os import gradio as gr from PIL import Image os.system("git clone https://github.com/AK391/stylegan2-ada-pytorch") os.chdir("stylegan2-ada-pytorch") os.mkdir("outputs") os.mkdir("outputs/images") os.system("gdown --id '11qCXjJg0-VQaKrdufnC5-XTTQJdTHbOC'") def inference(truncation,seeds): os.system("python generate.py --outdir=./outputs/images/ --trunc="+str(truncation)+" --seeds="+str(int(seeds))+" --network=network-snapshot-000257.pkl") seeds = int(seeds) image = Image.open(f"./outputs/images/seed{seeds:04d}.png") return image gr.Interface(inference,["number","number"],"pil").launch()