Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
from PIL import Image
|
|
|
|
|
|
|
| 4 |
|
| 5 |
os.system("git clone https://github.com/AK391/stylegan2-ada-pytorch")
|
| 6 |
|
|
@@ -10,10 +12,11 @@ os.chdir("stylegan2-ada-pytorch")
|
|
| 10 |
os.mkdir("outputs")
|
| 11 |
os.mkdir("outputs/images")
|
| 12 |
|
| 13 |
-
|
|
|
|
| 14 |
|
| 15 |
def inference(truncation,seeds):
|
| 16 |
-
os.system("python generate.py --outdir=./outputs/images/ --trunc="+str(truncation)+" --seeds="+str(int(seeds))+" --network=
|
| 17 |
seeds = int(seeds)
|
| 18 |
image = Image.open(f"./outputs/images/seed{seeds:04d}.png")
|
| 19 |
return image
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
from PIL import Image
|
| 4 |
+
from huggingface_hub import hf_hub_url, cached_download
|
| 5 |
+
|
| 6 |
|
| 7 |
os.system("git clone https://github.com/AK391/stylegan2-ada-pytorch")
|
| 8 |
|
|
|
|
| 12 |
os.mkdir("outputs")
|
| 13 |
os.mkdir("outputs/images")
|
| 14 |
|
| 15 |
+
config_file_url = hf_hub_url("AUBMC-AIM/OCTaGAN", filename="OCTaGAN.pkl")
|
| 16 |
+
cached_file = cached_download(config_file_url)
|
| 17 |
|
| 18 |
def inference(truncation,seeds):
|
| 19 |
+
os.system("python generate.py --outdir=./outputs/images/ --trunc="+str(truncation)+" --seeds="+str(int(seeds))+" --network="+cached_file)
|
| 20 |
seeds = int(seeds)
|
| 21 |
image = Image.open(f"./outputs/images/seed{seeds:04d}.png")
|
| 22 |
return image
|