Spaces:
Sleeping
Sleeping
Fix categories
Browse files
app.py
CHANGED
@@ -3,22 +3,17 @@ import gradio as gr
|
|
3 |
|
4 |
learn = load_learner('hotdogmodel.pkl')
|
5 |
|
6 |
-
|
7 |
-
#categories = ('kielbasa', 'pepperoni', 'chorizo', 'bratwurst', 'hotdog', 'sausage', 'salami')
|
8 |
-
categories = ('bratwurst1', 'chorizo1', 'hotdog1', 'kielbasa1', 'pepperoni1', 'salami1', 'sausage1')
|
9 |
|
10 |
|
11 |
|
12 |
def classify_image(img):
|
13 |
-
pred,
|
14 |
return dict(zip(categories, map(float,probs)))
|
15 |
|
16 |
-
#def classify_image(img):
|
17 |
-
# pred,idx,probs = learn.predict(img)
|
18 |
-
# return {categories[i] : float(probs[i]) for i in range(len(categories))}
|
19 |
|
20 |
image = gr.inputs.Image(shape=(192,192))
|
21 |
-
label = gr.outputs.Label(
|
22 |
|
23 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
|
24 |
intf.launch(inline=False)
|
|
|
3 |
|
4 |
learn = load_learner('hotdogmodel.pkl')
|
5 |
|
6 |
+
categories = ('bratwurst', 'chorizo', 'hotdog', 'kielbasa', 'pepperoni', 'salami', 'sausage')
|
|
|
|
|
7 |
|
8 |
|
9 |
|
10 |
def classify_image(img):
|
11 |
+
pred,_,probs = learn.predict(img)
|
12 |
return dict(zip(categories, map(float,probs)))
|
13 |
|
|
|
|
|
|
|
14 |
|
15 |
image = gr.inputs.Image(shape=(192,192))
|
16 |
+
label = gr.outputs.Label()
|
17 |
|
18 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
|
19 |
intf.launch(inline=False)
|