MammoGANesis / app.py
Ahsen Khaliq
Create app.py
520f551
raw
history blame
557 Bytes
import os
import gradio as gr
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,seed):
os.system("python generate.py --outdir=./outputs/images/ --trunc= "+truncation+" --seeds= "+seed+" --network=network-snapshot-000257.pkl")
image = Image.open(f"./outputs/images/seed{seeds:04d}.png")
return image
gr.Interface(inference,["number","number"],"pil").launch()