xelu3banh xelu3banh commited on
Commit
01538cb
·
0 Parent(s):

Duplicate from xelu3banh/anime12

Browse files

Co-authored-by: xelu3banh <[email protected]>

.gitattributes ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.model filter=lfs diff=lfs merge=lfs -text
11
+ *.msgpack 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
19
+ *.pkl filter=lfs diff=lfs merge=lfs -text
20
+ *.pb filter=lfs diff=lfs merge=lfs -text
21
+ *.pt filter=lfs diff=lfs merge=lfs -text
22
+ *.pth filter=lfs diff=lfs merge=lfs -text
23
+ *.rar filter=lfs diff=lfs merge=lfs -text
24
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
26
+ *.tflite filter=lfs diff=lfs merge=lfs -text
27
+ *.tgz filter=lfs diff=lfs merge=lfs -text
28
+ *.wasm filter=lfs diff=lfs merge=lfs -text
29
+ *.xz 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:68d9a900361fd28654621c27c97b4d75ef09845e151fa44ce726d77b9ef657ca
3
+ size 60963512
AnimeGANv3_src.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:75c0001206c43bba05918c2c3ae870690534845bd7b22c812f82bb4fb44c71f7
3
+ size 456896
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ duplicated_from: xelu3banh/anime12
12
+ ---
13
+
app.py ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_Trump v1.0":
18
+ f = "T"
19
+ elif Style == "AnimeGANv3_Shinkai":
20
+ f = "S"
21
+ elif Style == "AnimeGANv3_PortraitSketch":
22
+ f = "P"
23
+ elif Style == "AnimeGANv3_Hayao":
24
+ f = "H"
25
+ elif Style == "AnimeGANv3_Disney v1.0":
26
+ f = "D"
27
+ elif Style == "AnimeGANv3_JP_face v1.0":
28
+ f = "J"
29
+ else:
30
+ f = "U"
31
+
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:
41
+ print('global exception', error)
42
+ return None, None
43
+
44
+
45
+ title = "AnimeGANv3: To produce your own animation."
46
+ 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>
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;">
59
+ <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>
60
+ <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>
61
+ <a href="https://www.youtube.com/watch?v=iFjiaPlhVm4" target="___blank" style="margin-left: 14px;"><img src="https://img.shields.io/static/v1?label=YouTube&message=video 3&color=pink"/></a>
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(
83
+ inference, [
84
+ gr.inputs.Image(type="filepath", label="Input"),
85
+ gr.Dropdown([
86
+ 'AnimeGANv3_Hayao',
87
+ 'AnimeGANv3_Shinkai',
88
+ 'AnimeGANv3_Arcane',
89
+ 'AnimeGANv3_USA',
90
+ 'AnimeGANv3_Trump v1.0',
91
+ 'AnimeGANv3_Disney v1.0',
92
+ 'AnimeGANv3_PortraitSketch',
93
+ 'AnimeGANv3_JP_face v1.0',
94
+ ],
95
+ type="value",
96
+ value='AnimeGANv3_Hayao',
97
+ label='AnimeGANv3 Style'),
98
+ gr.inputs.Radio(['Yes', 'No'], type="value", default='No', label='Extract face'),
99
+ ], [
100
+ gr.outputs.Image(type="numpy", label="Output (The whole image)"),
101
+ gr.outputs.File(label="Download the output image")
102
+ ],
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)
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/120.jpg ADDED
samples/15566.jpg ADDED
samples/1_out.jpg ADDED
samples/23034.jpg ADDED
samples/52014.jpg ADDED
samples/7_out.jpg ADDED
samples/Hamabe Minami.jpg ADDED
samples/jp_13.jpg ADDED
samples/jp_20.jpg ADDED
samples/jp_38.jpg ADDED