Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from fastai.vision.all import *
|
|
3 |
import gradio as gr
|
4 |
|
5 |
# %% ../hugging-space-model-app.ipynb 7
|
6 |
-
learn = load_learner('
|
7 |
|
8 |
# %% ../hugging-space-model-app.ipynb 9
|
9 |
labels = learn.dls.vocab
|
@@ -13,9 +13,15 @@ def classify_image(img):
|
|
13 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
14 |
|
15 |
# %% ../hugging-space-model-app.ipynb 11
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
19 |
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
3 |
import gradio as gr
|
4 |
|
5 |
# %% ../hugging-space-model-app.ipynb 7
|
6 |
+
learn = load_learner('model.pkl')
|
7 |
|
8 |
# %% ../hugging-space-model-app.ipynb 9
|
9 |
labels = learn.dls.vocab
|
|
|
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>")
|
18 |
+
gr.Markdown("""##### Classifies human facial expressions from an uploaded image.
|
19 |
+
<b>Upload images and have fun🤗. Classifies facial expressions with 75% accuracy</b>""")
|
20 |
|
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)
|