Spaces:
adpro
/
Runtime error

adpro commited on
Commit
6dc07ec
1 Parent(s): 8bfd8fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -13
app.py CHANGED
@@ -32,9 +32,10 @@ def inference(img_path, Style, if_face=None):
32
  try:
33
  det_face = True if if_face=="Yes" else False
34
  output = AnimeGANv3_src.Convert(img, f, det_face)
 
35
  save_path = f"output/out.{img_path.rsplit('.')[-1]}"
36
- cv2.imwrite(save_path, output[:, :, ::-1])
37
- return output, save_path
38
  except RuntimeError as error:
39
  print('Error', error)
40
  except Exception as error:
@@ -47,12 +48,9 @@ description = r"""Official online demo for <a href='https://github.com/Tachibana
47
  It can be used to turn your photos or videos into anime.<br>
48
  To use it, simply upload your image. It can convert landscape photos to Hayao Miyazaki or Makoto Shinkai style anime, as well as 6 style conversions about human faces.<br>
49
  If AnimeGANv3 is helpful, please help to ⭐ the <a href='https://github.com/TachibanaYoshino/AnimeGANv3' target='_blank'>Github Repo</a> and recommend it to your friends. 😊
50
-
51
  """
52
  article = r"""
53
-
54
  [![GitHub Stars](https://img.shields.io/github/stars/TachibanaYoshino/AnimeGANv3?style=social)](https://github.com/TachibanaYoshino/AnimeGANv3)
55
-
56
  ### 🔥 Demo
57
  I. Video to anime (Hayao Style)
58
  <p style="display: flex;">
@@ -62,21 +60,16 @@ I. Video to anime (Hayao Style)
62
  </p>
63
  II. Video to anime (USA cartoon + Disney style)
64
  <a href="https://youtu.be/vJqQQMRYKh0"><img src="https://img.shields.io/static/v1?label=YouTube&message=AnimeGANv3_Trump style v1.5 &color=gold"/></a>
65
-
66
  ----------
67
-
68
  ## License
69
  This repo is made freely available to academic and non-academic entities for non-commercial purposes such as academic research, teaching, scientific publications. Permission is granted to use the AnimeGANv3 given that you agree to my license terms. Regarding the request for commercial use, please contact us via email to help you obtain the authorization letter.
70
-
71
  ## Acknowledgement
72
  * Huggingface UI is referenced from @akhaliq/GFPGAN.
73
  * The dataset of AnimeGANv3_JP_face v1.0 is from DCTnet and then manually optimized.
74
-
75
  ## Author
76
  Xin Chen
77
  If you have any question, please open an issue on GitHub Repo.
78
 
79
-
80
  <center><img src='https://visitor-badge.glitch.me/badge?page_id=AnimeGANv3_online' alt='visitor badge'></center>
81
  """
82
  gr.Interface(
@@ -103,6 +96,4 @@ gr.Interface(
103
  title=title,
104
  description=description,
105
  article=article,
106
- allow_flagging="never",
107
- examples=[['samples/7_out.jpg', 'AnimeGANv3_Arcane', "Yes"], ['samples/15566.jpg', 'AnimeGANv3_USA', "Yes"],['samples/23034.jpg', 'AnimeGANv3_Trump v1.0', "Yes"], ['samples/jp_13.jpg', 'AnimeGANv3_Hayao', "No"],
108
- ['samples/jp_20.jpg', 'AnimeGANv3_Shinkai', "No"], ['samples/Hamabe Minami.jpg', 'AnimeGANv3_Disney v1.0', "Yes"], ['samples/120.jpg', 'AnimeGANv3_JP_face v1.0', "Yes"], ['samples/52014.jpg', 'AnimeGANv3_PortraitSketch', "Yes"]]).launch(enable_queue=True)
 
32
  try:
33
  det_face = True if if_face=="Yes" else False
34
  output = AnimeGANv3_src.Convert(img, f, det_face)
35
+ result = cv2.resize(output, (img.shape[0],img.shape[1] ), interpolation = cv2.INTER_AREA)
36
  save_path = f"output/out.{img_path.rsplit('.')[-1]}"
37
+ cv2.imwrite(save_path, result[:, :, ::-1])
38
+ return result, save_path
39
  except RuntimeError as error:
40
  print('Error', error)
41
  except Exception as error:
 
48
  It can be used to turn your photos or videos into anime.<br>
49
  To use it, simply upload your image. It can convert landscape photos to Hayao Miyazaki or Makoto Shinkai style anime, as well as 6 style conversions about human faces.<br>
50
  If AnimeGANv3 is helpful, please help to ⭐ the <a href='https://github.com/TachibanaYoshino/AnimeGANv3' target='_blank'>Github Repo</a> and recommend it to your friends. 😊
 
51
  """
52
  article = r"""
 
53
  [![GitHub Stars](https://img.shields.io/github/stars/TachibanaYoshino/AnimeGANv3?style=social)](https://github.com/TachibanaYoshino/AnimeGANv3)
 
54
  ### 🔥 Demo
55
  I. Video to anime (Hayao Style)
56
  <p style="display: flex;">
 
60
  </p>
61
  II. Video to anime (USA cartoon + Disney style)
62
  <a href="https://youtu.be/vJqQQMRYKh0"><img src="https://img.shields.io/static/v1?label=YouTube&message=AnimeGANv3_Trump style v1.5 &color=gold"/></a>
 
63
  ----------
 
64
  ## License
65
  This repo is made freely available to academic and non-academic entities for non-commercial purposes such as academic research, teaching, scientific publications. Permission is granted to use the AnimeGANv3 given that you agree to my license terms. Regarding the request for commercial use, please contact us via email to help you obtain the authorization letter.
 
66
  ## Acknowledgement
67
  * Huggingface UI is referenced from @akhaliq/GFPGAN.
68
  * The dataset of AnimeGANv3_JP_face v1.0 is from DCTnet and then manually optimized.
 
69
  ## Author
70
  Xin Chen
71
  If you have any question, please open an issue on GitHub Repo.
72
 
 
73
  <center><img src='https://visitor-badge.glitch.me/badge?page_id=AnimeGANv3_online' alt='visitor badge'></center>
74
  """
75
  gr.Interface(
 
96
  title=title,
97
  description=description,
98
  article=article,
99
+ allow_flagging="never").launch(enable_queue=True)