Spaces:
Running
Running
Xin
commited on
Commit
•
9c00d3d
1
Parent(s):
973b0cd
update
Browse files- .gitattributes +2 -0
- AnimeGANv3_bin.so +3 -0
- AnimeGANv3_src.so +3 -0
- README.md +5 -5
- app.py +92 -0
- packages.txt +7 -0
- requirements.txt +11 -0
- samples/15566.jpg +0 -0
- samples/52014.jpg +0 -0
- samples/7_out.jpg +0 -0
- samples/jp_13.jpg +0 -0
- samples/jp_20.jpg +0 -0
- samples/jp_38.jpg +0 -0
.gitattributes
CHANGED
@@ -12,6 +12,7 @@
|
|
12 |
*.npy filter=lfs diff=lfs merge=lfs -text
|
13 |
*.npz filter=lfs diff=lfs merge=lfs -text
|
14 |
*.onnx filter=lfs diff=lfs merge=lfs -text
|
|
|
15 |
*.ot filter=lfs diff=lfs merge=lfs -text
|
16 |
*.parquet filter=lfs diff=lfs merge=lfs -text
|
17 |
*.pickle filter=lfs diff=lfs merge=lfs -text
|
@@ -29,3 +30,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
12 |
*.npy filter=lfs diff=lfs merge=lfs -text
|
13 |
*.npz filter=lfs diff=lfs merge=lfs -text
|
14 |
*.onnx filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.so filter=lfs diff=lfs merge=lfs -text
|
16 |
*.ot filter=lfs diff=lfs merge=lfs -text
|
17 |
*.parquet filter=lfs diff=lfs merge=lfs -text
|
18 |
*.pickle filter=lfs diff=lfs merge=lfs -text
|
|
|
30 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
31 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
32 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
33 |
+
|
AnimeGANv3_bin.so
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d8126a9d5f23395721b8144bf9322cd128c56ae6ab1dad6cba3f55a657c20b06
|
3 |
+
size 38041400
|
AnimeGANv3_src.so
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:73aa85994f3b1b6ca85272091946b09476378067998649224699ad1e6901cf26
|
3 |
+
size 446088
|
README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
---
|
2 |
title: AnimeGANv3
|
3 |
-
emoji:
|
4 |
colorFrom: green
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 3.
|
8 |
app_file: app.py
|
9 |
-
pinned:
|
|
|
10 |
---
|
11 |
|
12 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
title: AnimeGANv3
|
3 |
+
emoji: 😁
|
4 |
colorFrom: green
|
5 |
+
colorTo: blue
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 3.3.1
|
8 |
app_file: app.py
|
9 |
+
pinned: True
|
10 |
+
author: xin chen
|
11 |
---
|
12 |
|
|
app.py
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import cv2
|
3 |
+
import gradio as gr
|
4 |
+
import AnimeGANv3_src
|
5 |
+
|
6 |
+
|
7 |
+
os.makedirs('output', exist_ok=True)
|
8 |
+
|
9 |
+
|
10 |
+
def inference(img_path, Style, if_face=None):
|
11 |
+
print(img_path, Style, if_face)
|
12 |
+
try:
|
13 |
+
img = cv2.imread(img_path)
|
14 |
+
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
15 |
+
if Style == "AnimeGANv3_Arcane":
|
16 |
+
f = "A"
|
17 |
+
elif Style == "AnimeGANv3_Shinkai":
|
18 |
+
f = "S"
|
19 |
+
elif Style == "AnimeGANv3_PortraitSketch":
|
20 |
+
f = "P"
|
21 |
+
elif Style == "AnimeGANv3_Hayao":
|
22 |
+
f = "H"
|
23 |
+
else:
|
24 |
+
f = "U"
|
25 |
+
|
26 |
+
try:
|
27 |
+
det_face = True if if_face=="Yes" else False
|
28 |
+
output = AnimeGANv3_src.Convert(img, f, det_face)
|
29 |
+
save_path = f"output/out.{img_path.rsplit('.')[-1]}"
|
30 |
+
cv2.imwrite(save_path, output[:, :, ::-1])
|
31 |
+
return output, save_path
|
32 |
+
except RuntimeError as error:
|
33 |
+
print('Error', error)
|
34 |
+
except Exception as error:
|
35 |
+
print('global exception', error)
|
36 |
+
return None, None
|
37 |
+
|
38 |
+
|
39 |
+
title = "AnimeGANv3: To produce your own animation."
|
40 |
+
description = r"""Official online demo for <a href='https://github.com/TachibanaYoshino/AnimeGANv3' target='_blank'><b>AnimeGANv3</b></a>. If you like what I'm doing you can tip me on <a href='https://www.patreon.com/Asher_Chan' target='_blank'><b>**patreon**</b></a>.<br>
|
41 |
+
It can be used to turn your photos or videos into anime.<br>
|
42 |
+
To use it, simply upload your image. It can convert landscape photos to Hayao Miyazaki or Makoto Shinkai style anime, as well as 3 style conversions about human faces.<br>
|
43 |
+
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. 😊
|
44 |
+
|
45 |
+
"""
|
46 |
+
article = r"""
|
47 |
+
|
48 |
+
[![GitHub Stars](https://img.shields.io/github/stars/TachibanaYoshino/AnimeGANv3?style=social)](https://github.com/TachibanaYoshino/AnimeGANv3)
|
49 |
+
|
50 |
+
### 🗻 Demo: Video to anime (Hayao Style)
|
51 |
+
<p style="display: flex;">
|
52 |
+
<a href="https://youtu.be/EosubeJmAnE" target="___blank" style="margin-left: 14px;"><img src="https://img.shields.io/static/v1?label=YouTube&message=video 1&color=red"/></a>
|
53 |
+
<a href="https://youtu.be/5qLUflWb45E" target="___blank" style="margin-left: 14px;"><img src="https://img.shields.io/static/v1?label=YouTube&message=video 2&color=green"/></a>
|
54 |
+
<a href="https://youtu.be/0KaScDxgyBw" target="___blank" style="margin-left: 14px;"><img src="https://img.shields.io/static/v1?label=YouTube&message=video 3&color=pink"/></a>
|
55 |
+
</p>
|
56 |
+
|
57 |
+
----------
|
58 |
+
|
59 |
+
## License
|
60 |
+
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.
|
61 |
+
|
62 |
+
## Author
|
63 |
+
Xin Chen
|
64 |
+
If you have any question, please open an issue on GitHub Repo.
|
65 |
+
|
66 |
+
|
67 |
+
<center><img src='https://visitor-badge.glitch.me/badge?page_id=AnimeGANv3_online' alt='visitor badge'></center>
|
68 |
+
"""
|
69 |
+
gr.Interface(
|
70 |
+
inference, [
|
71 |
+
gr.inputs.Image(type="filepath", label="Input"),
|
72 |
+
gr.Dropdown([
|
73 |
+
'AnimeGANv3_Hayao',
|
74 |
+
'AnimeGANv3_Shinkai',
|
75 |
+
'AnimeGANv3_Arcane',
|
76 |
+
'AnimeGANv3_USA',
|
77 |
+
'AnimeGANv3_PortraitSketch',
|
78 |
+
],
|
79 |
+
type="value",
|
80 |
+
value='AnimeGANv3_Hayao',
|
81 |
+
label='AnimeGANv3 Style'),
|
82 |
+
gr.inputs.Radio(['Yes', 'No'], type="value", default='No', label='Extract face'),
|
83 |
+
], [
|
84 |
+
gr.outputs.Image(type="numpy", label="Output (The whole image)"),
|
85 |
+
gr.outputs.File(label="Download the output image")
|
86 |
+
],
|
87 |
+
title=title,
|
88 |
+
description=description,
|
89 |
+
article=article,
|
90 |
+
allow_flagging="never",
|
91 |
+
examples=[['samples/7_out.jpg', 'AnimeGANv3_Arcane', "Yes"], ['samples/15566.jpg', 'AnimeGANv3_USA', "Yes"], ['samples/jp_13.jpg', 'AnimeGANv3_Hayao', "No"],
|
92 |
+
['samples/jp_20.jpg', 'AnimeGANv3_Shinkai', "No"], ['samples/52014.jpg', 'AnimeGANv3_PortraitSketch', "Yes"]]).launch(enable_queue=True)
|
packages.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
g++-8-i686-linux-gnu
|
2 |
+
gcc-8-i686-linux-gnu
|
3 |
+
gcc-i686-linux-gnu
|
4 |
+
g++-i686-linux-gnu
|
5 |
+
ffmpeg
|
6 |
+
libsm6
|
7 |
+
libxext6
|
requirements.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pyarmor
|
2 |
+
pycryptodome
|
3 |
+
openvino
|
4 |
+
scipy
|
5 |
+
tqdm
|
6 |
+
pyyaml
|
7 |
+
yapf
|
8 |
+
opencv-python
|
9 |
+
numpy
|
10 |
+
onnxruntime
|
11 |
+
Pillow
|
samples/15566.jpg
ADDED
samples/52014.jpg
ADDED
samples/7_out.jpg
ADDED
samples/jp_13.jpg
ADDED
samples/jp_20.jpg
ADDED
samples/jp_38.jpg
ADDED