Ahsen Khaliq
commited on
Commit
·
b6679b7
1
Parent(s):
4a4961c
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,22 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
-
os.system("git clone https://github.com/onion-liu/BlendGAN.git")
|
| 3 |
os.system("gdown https://drive.google.com/uc?id=1eF04jKMLAb9DvzI72m8Akn5ykWf3EafE")
|
| 4 |
os.system("gdown https://drive.google.com/uc?id=14nevG94hNkkwaoK5eJLF1iv78cv5O8fN")
|
| 5 |
-
|
| 6 |
-
import torch
|
| 7 |
-
import gradio as gr
|
| 8 |
-
model2 = torch.hub.load(
|
| 9 |
-
"AK391/animegan2-pytorch:main",
|
| 10 |
-
"generator",
|
| 11 |
-
pretrained=True,
|
| 12 |
-
device="cuda",
|
| 13 |
-
progress=False
|
| 14 |
-
)
|
| 15 |
-
model1 = torch.hub.load("AK391/animegan2-pytorch:main", "generator", pretrained="face_paint_512_v1", device="cuda")
|
| 16 |
-
face2paint = torch.hub.load(
|
| 17 |
-
'AK391/animegan2-pytorch:main', 'face2paint',
|
| 18 |
-
size=512, device="cuda",side_by_side=False
|
| 19 |
-
)
|
| 20 |
def inference(img, ver):
|
| 21 |
os.system("""python style_transfer_folder.py --size 1024 --ckpt ./pretrained_models/blendgan.pt --psp_encoder_ckpt ./pretrained_models/psp_encoder.pt --style_img_path /content/BlendGAN/style/ --input_img_path /content/BlendGAN/input/ --outdir results/style_transfer/""")
|
| 22 |
return out
|
|
|
|
| 1 |
import os
|
|
|
|
| 2 |
os.system("gdown https://drive.google.com/uc?id=1eF04jKMLAb9DvzI72m8Akn5ykWf3EafE")
|
| 3 |
os.system("gdown https://drive.google.com/uc?id=14nevG94hNkkwaoK5eJLF1iv78cv5O8fN")
|
| 4 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
def inference(img, ver):
|
| 6 |
os.system("""python style_transfer_folder.py --size 1024 --ckpt ./pretrained_models/blendgan.pt --psp_encoder_ckpt ./pretrained_models/psp_encoder.pt --style_img_path /content/BlendGAN/style/ --input_img_path /content/BlendGAN/input/ --outdir results/style_transfer/""")
|
| 7 |
return out
|