Spaces:
Build error
Build error
First Commit
Browse files- .gitattributes +1 -0
- Goku.jpg +0 -0
- Ichigo.jpeg +0 -0
- Luffy.jpg +0 -0
- Naruto-Kurama-Mode.png +0 -0
- Robin.jpeg +0 -0
- app.py +57 -0
- model_2.pkl +3 -0
- requirements.txt +6 -0
.gitattributes
CHANGED
@@ -29,3 +29,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
32 |
+
model_2.pkl filter=lfs diff=lfs merge=lfs -text
|
Goku.jpg
ADDED
Ichigo.jpeg
ADDED
Luffy.jpg
ADDED
Naruto-Kurama-Mode.png
ADDED
Robin.jpeg
ADDED
app.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
learn = load_learner("model_2.pkl")
|
5 |
+
|
6 |
+
categories = learn.dls.vocab
|
7 |
+
for index, category in enumerate(categories):
|
8 |
+
if category == "Random Anime Photos":
|
9 |
+
categories[index] = "Others"
|
10 |
+
|
11 |
+
|
12 |
+
def classify_image(img):
|
13 |
+
pred, idx, probs = learn.predict(img)
|
14 |
+
return dict(zip(categories, map(float, probs)))
|
15 |
+
|
16 |
+
|
17 |
+
image = gr.inputs.Image(shape=(360, 360))
|
18 |
+
label = gr.outputs.Label()
|
19 |
+
examples = [
|
20 |
+
"Luffy.jpg",
|
21 |
+
"Naruto-Kurama-Mode.png",
|
22 |
+
"Goku.jpg",
|
23 |
+
"Ichigo.jpeg",
|
24 |
+
"Robin.jpeg"
|
25 |
+
]
|
26 |
+
|
27 |
+
title = "Top 10 Shounen Anime Protagonists Classifier"
|
28 |
+
description = "Fine tuned a resnet152 image classifier such that it is able to recognize protagonists of top 10 Shounen Animes.<br>"
|
29 |
+
article = """
|
30 |
+
Animes and its protagonists this image classifier will recognize:
|
31 |
+
|
32 |
+
1. One Piece - Monkey D. Luffy
|
33 |
+
2. Naruto: Shippuden - Naruto Uzumaki
|
34 |
+
3. My Hero Academia - Izuku Midoriya
|
35 |
+
4. Dragon Ball Z - Son Goku aka Kakarot
|
36 |
+
5. Fairy Tail - Natsu Dragneel
|
37 |
+
6. Yu Yu Hakusho - Yusuke Urameshi
|
38 |
+
7. Bleach - Ichigo Kurosaki
|
39 |
+
8. Hunter X Hunter - Gon Freecss
|
40 |
+
9. Fullmetal Alchemist - Edward Elric
|
41 |
+
10. Attack on Titan - Eren Yeager
|
42 |
+
|
43 |
+
Rest all other anime characters will be classified as others.
|
44 |
+
"""
|
45 |
+
|
46 |
+
|
47 |
+
intf = gr.Interface(
|
48 |
+
fn=classify_image,
|
49 |
+
inputs=image,
|
50 |
+
outputs=label,
|
51 |
+
examples=examples,
|
52 |
+
title=title,
|
53 |
+
description=description,
|
54 |
+
article=article,
|
55 |
+
theme="huggingface",
|
56 |
+
)
|
57 |
+
intf.launch(inline=False)
|
model_2.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e2bb226ce46eba9bc5d029ca73dada583c4c9fd7e0325911e6e4e09df3d552db
|
3 |
+
size 242131931
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|
3 |
+
torch
|
4 |
+
gradio
|
5 |
+
numpy
|
6 |
+
pandas
|