Ahsen Khaliq commited on
Commit
6ac90f7
1 Parent(s): a17e553

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -36,7 +36,7 @@ os.system("mv shape_predictor_68_face_landmarks.dat models/dlibshape_predictor_6
36
 
37
  device = 'cpu'
38
 
39
- os.system("gdown https://drive.google.com/uc?id=1Yr7KuD959btpmcKGAUsbAk5rPjX2MytK")
40
  os.system("mv stylegan2-ffhq-config-f.pt models/stylegan2-ffhq-config-f.pt")
41
 
42
 
@@ -93,16 +93,12 @@ def inference(img):
93
  generator.eval()
94
 
95
  original_my_sample = original_generator(my_w, input_is_latent=True)
96
- my_sample = generator(my_w, input_is_latent=True)
97
-
98
- return
99
-
100
- my_output = torch.cat([style_image, face, my_sample], 0)
101
-
102
- return my_output
103
 
104
  title = "AnimeGANv2"
105
  description = "Gradio Demo for AnimeGanv2 Face Portrait. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below. Please use a cropped portrait picture for best results similar to the examples below."
106
  article = "<p style='text-align: center'><a href='https://github.com/bryandlee/animegan2-pytorch' target='_blank'>Github Repo Pytorch</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_animegan' alt='visitor badge'></center> <p style='text-align: center'>samples from repo: <img src='https://user-images.githubusercontent.com/26464535/129888683-98bb6283-7bb8-4d1a-a04a-e795f5858dcf.gif' alt='animation'/> <img src='https://user-images.githubusercontent.com/26464535/137619176-59620b59-4e20-4d98-9559-a424f86b7f24.jpg' alt='animation'/><img src='https://user-images.githubusercontent.com/26464535/127134790-93595da2-4f8b-4aca-a9d7-98699c5e6914.jpg' alt='animation'/></p>"
107
 
108
- gr.Interface(inference, [gr.inputs.Image(type="file")], gr.outputs.Image(type="pil"),title=title,description=description,article=article,enable_queue=True,allow_flagging=False).launch()
 
36
 
37
  device = 'cpu'
38
 
39
+ os.system("gdown https://drive.google.com/uc?id=1X6AvjLltUAYZrarLdrdGav5gsRkqJYOE")
40
  os.system("mv stylegan2-ffhq-config-f.pt models/stylegan2-ffhq-config-f.pt")
41
 
42
 
 
93
  generator.eval()
94
 
95
  original_my_sample = original_generator(my_w, input_is_latent=True)
96
+ my_sample = generator(my_w, input_is_latent=True)
97
+ npimage = my_sample[0].permute(1, 2, 0).detach().numpy()
98
+ return npimage
 
 
 
 
99
 
100
  title = "AnimeGANv2"
101
  description = "Gradio Demo for AnimeGanv2 Face Portrait. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below. Please use a cropped portrait picture for best results similar to the examples below."
102
  article = "<p style='text-align: center'><a href='https://github.com/bryandlee/animegan2-pytorch' target='_blank'>Github Repo Pytorch</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_animegan' alt='visitor badge'></center> <p style='text-align: center'>samples from repo: <img src='https://user-images.githubusercontent.com/26464535/129888683-98bb6283-7bb8-4d1a-a04a-e795f5858dcf.gif' alt='animation'/> <img src='https://user-images.githubusercontent.com/26464535/137619176-59620b59-4e20-4d98-9559-a424f86b7f24.jpg' alt='animation'/><img src='https://user-images.githubusercontent.com/26464535/127134790-93595da2-4f8b-4aca-a9d7-98699c5e6914.jpg' alt='animation'/></p>"
103
 
104
+ gr.Interface(inference, [gr.inputs.Image(type="file")], gr.outputs.Image(type="numpy"),title=title,description=description,article=article,enable_queue=True,allow_flagging=False).launch()