Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
·
520f551
1
Parent(s):
61a3c08
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
os.system("git clone https://github.com/AK391/stylegan2-ada-pytorch")
|
5 |
+
|
6 |
+
os.chdir("stylegan2-ada-pytorch")
|
7 |
+
|
8 |
+
os.mkdir("outputs")
|
9 |
+
os.mkdir("outputs/images")
|
10 |
+
|
11 |
+
os.system("gdown --id '11qCXjJg0-VQaKrdufnC5-XTTQJdTHbOC'")
|
12 |
+
|
13 |
+
def inference(truncation,seed):
|
14 |
+
os.system("python generate.py --outdir=./outputs/images/ --trunc= "+truncation+" --seeds= "+seed+" --network=network-snapshot-000257.pkl")
|
15 |
+
image = Image.open(f"./outputs/images/seed{seeds:04d}.png")
|
16 |
+
return image
|
17 |
+
|
18 |
+
gr.Interface(inference,["number","number"],"pil").launch()
|