File size: 589 Bytes
520f551
 
e5c2fbc
520f551
 
 
 
 
 
 
 
 
 
cad01cd
 
520f551
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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()