MammoGANesis / app.py
Ahsen Khaliq
Update app.py
cad01cd
raw
history blame
589 Bytes
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(seeds)+" --network=network-snapshot-000257.pkl")
image = Image.open(f"./outputs/images/seed{seeds:04d}.png")
return image
gr.Interface(inference,["number","number"],"pil").launch()