Ahsen Khaliq commited on
Commit
659d1e7
1 Parent(s): 36e3bf3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -4,9 +4,7 @@ pystuck.run_server()
4
 
5
 
6
  import os
7
- os.system("wget https://github.com/Sxela/ArcaneGAN/releases/download/v0.4/ArcaneGANv0.4.jit")
8
- os.system("wget https://github.com/Sxela/ArcaneGAN/releases/download/v0.3/ArcaneGANv0.3.jit")
9
- os.system("wget https://github.com/Sxela/ArcaneGAN/releases/download/v0.2/ArcaneGANv0.2.jit")
10
  os.system("pip -qq install facenet_pytorch")
11
  from facenet_pytorch import MTCNN
12
  from torchvision import transforms
@@ -15,6 +13,11 @@ from tqdm.notebook import tqdm
15
  import gradio as gr
16
  import torch
17
 
 
 
 
 
 
18
  mtcnn = MTCNN(image_size=256, margin=80)
19
 
20
  # simplest ye olde trustworthy MTCNN for face detection with landmarks
@@ -120,9 +123,9 @@ def proc_pil_img(input_image, model):
120
 
121
 
122
 
123
- modelv4 = torch.jit.load('./ArcaneGANv0.4.jit').eval().cuda().half()
124
- modelv3 = torch.jit.load('./ArcaneGANv0.3.jit').eval().cuda().half()
125
- modelv2 = torch.jit.load('./ArcaneGANv0.2.jit').eval().cuda().half()
126
 
127
  def process(im, version):
128
  if version == 'version 0.4':
 
4
 
5
 
6
  import os
7
+ from huggingface_hub import hf_hub_download
 
 
8
  os.system("pip -qq install facenet_pytorch")
9
  from facenet_pytorch import MTCNN
10
  from torchvision import transforms
 
13
  import gradio as gr
14
  import torch
15
 
16
+ modelarcanev4 = hf_hub_download(repo_id="akhaliq/ArcaneGANv0.4", filename="ArcaneGANv0.4.jit")
17
+ modelarcanev3 = hf_hub_download(repo_id="akhaliq/ArcaneGANv0.3", filename="ArcaneGANv0.3.jit")
18
+ modelarcanev2 = hf_hub_download(repo_id="akhaliq/ArcaneGANv0.2", filename="ArcaneGANv0.2.jit")
19
+
20
+
21
  mtcnn = MTCNN(image_size=256, margin=80)
22
 
23
  # simplest ye olde trustworthy MTCNN for face detection with landmarks
 
123
 
124
 
125
 
126
+ modelv4 = torch.jit.load(modelarcanev4).eval().cuda().half()
127
+ modelv3 = torch.jit.load(modelarcanev3).eval().cuda().half()
128
+ modelv2 = torch.jit.load(modelarcanev2).eval().cuda().half()
129
 
130
  def process(im, version):
131
  if version == 'version 0.4':