Spaces:
Build error
Build error
update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,15 @@
|
|
| 1 |
-
|
| 2 |
|
| 3 |
__all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
|
| 4 |
|
| 5 |
-
from fastai.vision.all import *
|
| 6 |
import gradio as gr
|
| 7 |
-
import timm
|
| 8 |
|
| 9 |
# Some magic according to https://forums.fast.ai/t/lesson-2-official-topic/96033/376?page=17
|
| 10 |
def is_happy(x):
|
| 11 |
return x[0].isupper() # Used by model
|
| 12 |
|
| 13 |
-
import sys
|
| 14 |
-
sys.modules["__main__"].is_happy = is_happy
|
| 15 |
|
| 16 |
# Upload your model
|
| 17 |
learn = load_learner('model.pkl')
|
|
@@ -26,7 +24,7 @@ image = gr.Image()
|
|
| 26 |
label = gr.Label()
|
| 27 |
|
| 28 |
# Upload your own images and link them
|
| 29 |
-
examples = ['
|
| 30 |
|
| 31 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 32 |
intf.launch()
|
|
|
|
| 1 |
+
|
| 2 |
|
| 3 |
__all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
|
| 4 |
|
|
|
|
| 5 |
import gradio as gr
|
|
|
|
| 6 |
|
| 7 |
# Some magic according to https://forums.fast.ai/t/lesson-2-official-topic/96033/376?page=17
|
| 8 |
def is_happy(x):
|
| 9 |
return x[0].isupper() # Used by model
|
| 10 |
|
| 11 |
+
# import sys
|
| 12 |
+
# sys.modules["__main__"].is_happy = is_happy
|
| 13 |
|
| 14 |
# Upload your model
|
| 15 |
learn = load_learner('model.pkl')
|
|
|
|
| 24 |
label = gr.Label()
|
| 25 |
|
| 26 |
# Upload your own images and link them
|
| 27 |
+
examples = ['angry.jpg', 'happy.jpg', 'Person emotion sad.jpg']
|
| 28 |
|
| 29 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 30 |
intf.launch()
|