vumichien commited on
Commit
f2cbd96
·
1 Parent(s): 8e7b28c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -21
app.py CHANGED
@@ -87,11 +87,11 @@ def convert(img, model, scale):
87
  os.makedirs('output', exist_ok=True)
88
 
89
  MODEL_PATH = {
90
- "AnimeGANv2_Hayao": hf_hub_download('vumichien/AnimeGANv2_Hayao', 'AnimeGANv2_Hayao.onnx'),
91
- "AnimeGANv2_Shinkai": hf_hub_download('vumichien/AnimeGANv2_Shinkai', 'AnimeGANv2_Shinkai.onnx'),
92
- "AnimeGANv2_Paprika": hf_hub_download('vumichien/AnimeGANv2_Paprika', 'AnimeGANv2_Paprika.onnx'),
93
- "AnimeGANv3_PortraitSketch": hf_hub_download('vumichien/AnimeGANv3_PortraitSketch', 'AnimeGANv3_PortraitSketch.onnx'),
94
- "AnimeGANv3_JP_face": hf_hub_download('vumichien/AnimeGANv3_JP_face', 'AnimeGANv3_JP_face.onnx'),
95
  }
96
 
97
 
@@ -106,34 +106,35 @@ def inference(img_path, model, focus_face=None):
106
  ### Layout ###
107
 
108
  title = "AnimeGANv2: To produce your own animation 😶‍🌫️"
109
- description = r"""### 🔥Demo AnimeGANv2: To produce your own animation. <br>
 
110
  #### How to use:
111
- * Upload your image,
112
- * Select the style,
113
- * Choice of whether to extract the face.(Warning: Yes if there is a face in the image)
114
  """
115
  article = r"""
116
  <center><img src='https://visitor-badge.glitch.me/badge?page_id=AnimeGAN_demo&left_color=green&right_color=blue' alt='visitor badge'></center>
117
  <center><a href='https://github.com/TachibanaYoshino/AnimeGANv3' target='_blank'>Github Repo</a></center>
118
  """
119
- examples=[['sample1.jpg', 'AnimeGANv3_PortraitSketch', "Yes"],
120
- ['sample2.jpg', 'AnimeGANv3_PortraitSketch', "No"],
121
- ['sample3.jpg', 'AnimeGANv2_Hayao', "No"],
122
- ['sample4.jpeg', 'AnimeGANv2_Shinkai', "No"],
123
- ['sample5.jpg', 'AnimeGANv2_Paprika', "No"],
124
- ['sample6.jpeg', 'AnimeGANv3_JP_face', "No"]]
125
  gr.Interface(
126
  inference, [
127
  gr.Image(type="filepath", label="Input image"),
128
  gr.Dropdown([
129
- 'AnimeGANv2_Hayao',
130
- 'AnimeGANv2_Shinkai',
131
- 'AnimeGANv2_Paprika',
132
- 'AnimeGANv3_PortraitSketch',
133
- 'AnimeGANv3_JP_face',
134
  ],
135
  type="value",
136
- value='AnimeGANv3_PortraitSketch',
137
  label='AnimeGAN Style'),
138
  gr.Radio(['Yes', 'No'], type="value", value='No', label='Extract face'),
139
  ], [
 
87
  os.makedirs('output', exist_ok=True)
88
 
89
  MODEL_PATH = {
90
+ "Hayao": hf_hub_download('vumichien/AnimeGANv2_Hayao', 'AnimeGANv2_Hayao.onnx'),
91
+ "Shinkai": hf_hub_download('vumichien/AnimeGANv2_Shinkai', 'AnimeGANv2_Shinkai.onnx'),
92
+ "Paprika": hf_hub_download('vumichien/AnimeGANv2_Paprika', 'AnimeGANv2_Paprika.onnx'),
93
+ "PortraitSketch": hf_hub_download('vumichien/AnimeGANv3_PortraitSketch', 'AnimeGANv3_PortraitSketch.onnx'),
94
+ "JP_face": hf_hub_download('vumichien/AnimeGANv3_JP_face', 'AnimeGANv3_JP_face.onnx'),
95
  }
96
 
97
 
 
106
  ### Layout ###
107
 
108
  title = "AnimeGANv2: To produce your own animation 😶‍🌫️"
109
+ description = r"""
110
+ ### 🔥Demo AnimeGANv2: To produce your own animation. <br>
111
  #### How to use:
112
+ * 1. Upload your image
113
+ * 2. Select the style (For human: PortraitSketch, JP_face; For scene: Hayao, Shinkai, Paprika)
114
+ * 3. Choice of whether to extract the face.(Warning: Yes if there is a face in the image)
115
  """
116
  article = r"""
117
  <center><img src='https://visitor-badge.glitch.me/badge?page_id=AnimeGAN_demo&left_color=green&right_color=blue' alt='visitor badge'></center>
118
  <center><a href='https://github.com/TachibanaYoshino/AnimeGANv3' target='_blank'>Github Repo</a></center>
119
  """
120
+ examples=[['sample1.jpg', 'PortraitSketch', "Yes"],
121
+ ['sample2.jpg', 'PortraitSketch', "No"],
122
+ ['sample3.jpg', 'Hayao', "No"],
123
+ ['sample4.jpeg', 'Shinkai', "No"],
124
+ ['sample5.jpg', 'Paprika', "No"],
125
+ ['sample6.jpeg', 'JP_face', "No"]]
126
  gr.Interface(
127
  inference, [
128
  gr.Image(type="filepath", label="Input image"),
129
  gr.Dropdown([
130
+ 'Hayao',
131
+ 'Shinkai',
132
+ 'Paprika',
133
+ 'PortraitSketch',
134
+ 'JP_face',
135
  ],
136
  type="value",
137
+ value='PortraitSketch',
138
  label='AnimeGAN Style'),
139
  gr.Radio(['Yes', 'No'], type="value", value='No', label='Extract face'),
140
  ], [