Spaces:
Runtime error
Runtime error
app + images
Browse files- .gitignore +11 -0
- app.py +20 -0
.gitignore
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.pkl
|
2 |
+
.gitattributes
|
3 |
+
models/
|
4 |
+
tmp/
|
5 |
+
*.bak
|
6 |
+
*.pkl
|
7 |
+
bears/
|
8 |
+
__pycache__/
|
9 |
+
.last_checked
|
10 |
+
.gitconfig
|
11 |
+
.ipynb_checkpoints/
|
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import gradio as gr
|
4 |
+
from glob import glob
|
5 |
+
|
6 |
+
learn = load_learner('model_ft15(extra).pkl')
|
7 |
+
|
8 |
+
def classify_image(img):
|
9 |
+
pred,idx,probs = learn.predict(img)
|
10 |
+
return dict(zip(categories, map(float,probs)))
|
11 |
+
|
12 |
+
image = gr.inputs.Image(shape=(192, 192))
|
13 |
+
label = gr.outputs.Label()
|
14 |
+
examples = []
|
15 |
+
for image in glob('./anime_character_recognizer/examples/*'):
|
16 |
+
transition_name = re.sub('./anime_character_recognizer/examples/', '', image)
|
17 |
+
examples.append(transition_name)
|
18 |
+
|
19 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
20 |
+
intf.launch(inline=False)
|