Ahsen Khaliq commited on
Commit
103e730
1 Parent(s): 399fe54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -1,19 +1,13 @@
1
  import os
2
  import gradio as gr
3
- os.system('pip install matplotlib')
4
- os.system('pip install deepface')
5
- from deepface import DeepFace
6
- backends = ['opencv', 'ssd', 'dlib', 'mtcnn']
7
 
8
  os.system("wget https://www.dropbox.com/s/fgupbov77x4rrru/blendgan.pt")
9
  os.system("wget https://www.dropbox.com/s/v8q0dd3r4u20659/psp_encoder.pt")
10
- import matplotlib.pyplot as plt
11
 
12
  def inference(content, style):
13
- conimg = DeepFace.detectFace(content.name, detector_backend = backends[0])
14
- plt.imsave('content.png', conimg, cmap='Greys')
15
- styleimg = DeepFace.detectFace(style.name, detector_backend = backends[0])
16
- plt.imsave('style.png', styleimg, cmap='Greys')
17
  os.system("""python style_transfer_folder.py --size 1024 --ckpt ./blendgan.pt --psp_encoder_ckpt ./psp_encoder.pt --style_img_path style.png --input_img_path content.png""")
18
  return "out.jpg"
19
 
1
  import os
2
  import gradio as gr
3
+ from PIL import Image
 
 
 
4
 
5
  os.system("wget https://www.dropbox.com/s/fgupbov77x4rrru/blendgan.pt")
6
  os.system("wget https://www.dropbox.com/s/v8q0dd3r4u20659/psp_encoder.pt")
 
7
 
8
  def inference(content, style):
9
+ content.save('content.png')
10
+ style.save('style.png')
 
 
11
  os.system("""python style_transfer_folder.py --size 1024 --ckpt ./blendgan.pt --psp_encoder_ckpt ./psp_encoder.pt --style_img_path style.png --input_img_path content.png""")
12
  return "out.jpg"
13