Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,8 @@ def classify_image(img):
|
|
12 |
pred,pred_idx,probs = learn.predict(img)
|
13 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
14 |
|
|
|
|
|
15 |
# %% ../hugging-space-model-app.ipynb 11
|
16 |
with gr.Blocks(theme=gr.themes.Soft())as demo:
|
17 |
gr.HTML("<center><h1>EmoPix - Facial Expressions Classifier! ππ</h1><center>")
|
@@ -21,7 +23,8 @@ with gr.Blocks(theme=gr.themes.Soft())as demo:
|
|
21 |
|
22 |
gr.Interface(fn=classify_image,
|
23 |
inputs=gr.components.Image(),
|
24 |
-
outputs=gr.components.Label(show_label=True,num_top_classes=3)
|
|
|
25 |
|
26 |
|
27 |
demo.launch(inline=False)
|
|
|
12 |
pred,pred_idx,probs = learn.predict(img)
|
13 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
14 |
|
15 |
+
examples = ['afraid.jpg','anger.jpg','happyface.jpg','disgust.jpg','sadface.webp','neutral.webp']
|
16 |
+
|
17 |
# %% ../hugging-space-model-app.ipynb 11
|
18 |
with gr.Blocks(theme=gr.themes.Soft())as demo:
|
19 |
gr.HTML("<center><h1>EmoPix - Facial Expressions Classifier! ππ</h1><center>")
|
|
|
23 |
|
24 |
gr.Interface(fn=classify_image,
|
25 |
inputs=gr.components.Image(),
|
26 |
+
outputs=gr.components.Label(show_label=True,num_top_classes=3)
|
27 |
+
examples=examples)
|
28 |
|
29 |
|
30 |
demo.launch(inline=False)
|