aliabd HF staff commited on
Commit
0cfb7ae
β€’
1 Parent(s): 16c124e

Delete app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +0 -38
app.py DELETED
@@ -1,38 +0,0 @@
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",
8
- pretrained=True,
9
- progress=False
10
- )
11
- model1 = torch.hub.load("AK391/animegan2-pytorch:main", "generator", pretrained="face_paint_512_v1")
12
- face2paint = torch.hub.load(
13
- 'AK391/animegan2-pytorch:main', 'face2paint',
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)
20
- else:
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')],
32
- outputs=gr.outputs.Image(type="pil"),
33
- title=title,
34
- description=description,
35
- article=article,
36
- examples=examples)
37
-
38
- demo.launch()