Trial 1
Browse files- ShoeClassifier.pkl +3 -0
- app.py +20 -4
- dailytrainer.jpeg +0 -0
- racers.jpeg +0 -0
- stability.jpeg +0 -0
- tempo.jpeg +0 -0
ShoeClassifier.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c7a7377c297adc7a6f6c291f549687bcfe55118b54f76b0a90cfbf33e9b67195
|
3 |
+
size 102885663
|
app.py
CHANGED
@@ -1,9 +1,25 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
|
4 |
-
def
|
5 |
-
return
|
6 |
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
|
4 |
|
5 |
+
def shoe(x):
|
6 |
+
return x[0].isupper()
|
7 |
|
8 |
|
9 |
+
learn = load_learner('ShoeClassifier.pkl')
|
10 |
+
categories = ("everyday running shoes", "running racing shoes",
|
11 |
+
"stability running shoes", "tempo running shoes")
|
12 |
+
|
13 |
+
|
14 |
+
def classify_image(img):
|
15 |
+
pred, idx, probs = learn.predict(img)
|
16 |
+
return dict(zip(categories, map(float, probs)))
|
17 |
+
|
18 |
+
|
19 |
+
image = gr.inputs.Image(shape=(256, 256))
|
20 |
+
label = gr.outputs.Label()
|
21 |
+
examples = ["racers.jpeg", "stability.jpeg", "dailytrainer.jpeg", "tempo.jpeg"]
|
22 |
+
|
23 |
+
intf = gr.Interface(fn=classify_image, inputs=image,
|
24 |
+
outputs=label, examples=examples)
|
25 |
+
intf.launch(inline=False)
|
dailytrainer.jpeg
ADDED
![]() |
racers.jpeg
ADDED
![]() |
stability.jpeg
ADDED
![]() |
tempo.jpeg
ADDED
![]() |