aliabd HF staff commited on
Commit
ec7283e
Β·
1 Parent(s): b274d9f

Upload with huggingface_hub

Browse files
Files changed (3) hide show
  1. DESCRIPTION.md +1 -0
  2. README.md +1 -1
  3. app.py +0 -8
DESCRIPTION.md ADDED
@@ -0,0 +1 @@
 
 
1
+ Recreate the viral AnimeGAN image transformation demo.
README.md CHANGED
@@ -1,7 +1,7 @@
1
 
2
  ---
3
  title: animeganv2
4
- emoji: πŸ€—
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
 
1
 
2
  ---
3
  title: animeganv2
4
+ emoji: πŸ”₯
5
  colorFrom: indigo
6
  colorTo: indigo
7
  sdk: gradio
app.py CHANGED
@@ -1,11 +1,7 @@
1
- # URL: https://huggingface.co/spaces/gradio/animeganv2
2
- # DESCRIPTION: Recreate the viral AnimeGAN image transformation demo.
3
- # imports
4
  import gradio as gr
5
  from PIL import Image
6
  import torch
7
 
8
- # load the models
9
  model2 = torch.hub.load(
10
  "AK391/animegan2-pytorch:main",
11
  "generator",
@@ -18,7 +14,6 @@ face2paint = torch.hub.load(
18
  size=512,side_by_side=False
19
  )
20
 
21
- # define the core function
22
  def inference(img, ver):
23
  if ver == 'version 2 (πŸ”Ί robustness,πŸ”» stylization)':
24
  out = face2paint(model2, img)
@@ -26,13 +21,11 @@ def inference(img, ver):
26
  out = face2paint(model1, img)
27
  return out
28
 
29
- # define the title, description and examples
30
  title = "AnimeGANv2"
31
  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."
32
  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>"
33
  examples=[['groot.jpeg','version 2 (πŸ”Ί robustness,πŸ”» stylization)'],['gongyoo.jpeg','version 1 (πŸ”Ί stylization, πŸ”» robustness)']]
34
 
35
- # define the interface
36
  demo = gr.Interface(
37
  fn=inference,
38
  inputs=[gr.inputs.Image(type="pil"),gr.inputs.Radio(['version 1 (πŸ”Ί stylization, πŸ”» robustness)','version 2 (πŸ”Ί robustness,πŸ”» stylization)'], type="value", default='version 2 (πŸ”Ί robustness,πŸ”» stylization)', label='version')],
@@ -42,5 +35,4 @@ demo = gr.Interface(
42
  article=article,
43
  examples=examples)
44
 
45
- # launch
46
  demo.launch()
 
 
 
 
1
  import gradio as gr
2
  from PIL import Image
3
  import torch
4
 
 
5
  model2 = torch.hub.load(
6
  "AK391/animegan2-pytorch:main",
7
  "generator",
 
14
  size=512,side_by_side=False
15
  )
16
 
 
17
  def inference(img, ver):
18
  if ver == 'version 2 (πŸ”Ί robustness,πŸ”» stylization)':
19
  out = face2paint(model2, img)
 
21
  out = face2paint(model1, img)
22
  return out
23
 
 
24
  title = "AnimeGANv2"
25
  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."
26
  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>"
27
  examples=[['groot.jpeg','version 2 (πŸ”Ί robustness,πŸ”» stylization)'],['gongyoo.jpeg','version 1 (πŸ”Ί stylization, πŸ”» robustness)']]
28
 
 
29
  demo = gr.Interface(
30
  fn=inference,
31
  inputs=[gr.inputs.Image(type="pil"),gr.inputs.Radio(['version 1 (πŸ”Ί stylization, πŸ”» robustness)','version 2 (πŸ”Ί robustness,πŸ”» stylization)'], type="value", default='version 2 (πŸ”Ί robustness,πŸ”» stylization)', label='version')],
 
35
  article=article,
36
  examples=examples)
37
 
 
38
  demo.launch()