Spaces:
Build error
Build error
wip
Browse files
app.py
CHANGED
@@ -1,8 +1,17 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
image = gr.inputs.Image(shape=(192,192))
|
4 |
label = gr.outputs.Label()
|
5 |
examples = ['bmw_750.jpeg']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
intf = gr.Interface(fn=classify_image, inputs=image, outpluts=label, examples=examples)
|
8 |
intf.launch(inline=False)
|
|
|
1 |
import gradio as gr
|
2 |
+
from fastcore.all import *
|
3 |
+
import time
|
4 |
|
5 |
image = gr.inputs.Image(shape=(192,192))
|
6 |
label = gr.outputs.Label()
|
7 |
examples = ['bmw_750.jpeg']
|
8 |
+
categories = ['bmw car', 'mercedes car']
|
9 |
+
|
10 |
+
learn.load_learner("export.kpl")
|
11 |
+
|
12 |
+
def classify_image(img):
|
13 |
+
pred, _, prob = learn.predict(img)
|
14 |
+
return dict(zip(categories, map(float, probs)))
|
15 |
|
16 |
intf = gr.Interface(fn=classify_image, inputs=image, outpluts=label, examples=examples)
|
17 |
intf.launch(inline=False)
|