Spaces:
Sleeping
Sleeping
Myrax3000
commited on
Commit
·
1f7d3d9
1
Parent(s):
f89e1c2
classify card
Browse files- app.py +13 -3
- king.jpg +0 -0
- model.pkl +3 -0
- pikachu.jpg +0 -0
- yugi.jpg +0 -0
app.py
CHANGED
@@ -1,7 +1,17 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
|
4 |
+
learn = load_learner('model.pkl')
|
|
|
5 |
|
6 |
+
categories = ('playing', 'pokemon', 'yugioh')
|
7 |
+
|
8 |
+
def classify_image(photo):
|
9 |
+
card_type,_,probs = learn.predict(photo)
|
10 |
+
return dict(zip(categories, map(float, probs)))
|
11 |
+
|
12 |
+
image = gr.inputs.Image(shape=(192,192))
|
13 |
+
label = gr.outputs.Labels()
|
14 |
+
exemples = ['king.jpg', 'yugi.jpg', 'pikachu.jpg']
|
15 |
+
|
16 |
+
iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, exemples=exemples)
|
17 |
iface.launch()
|
king.jpg
ADDED
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d4be1fb1105b68947d02a106684ec52e5a774931b9d681bcc65e38b6bfeedf71
|
3 |
+
size 46959557
|
pikachu.jpg
ADDED
yugi.jpg
ADDED