Spaces:
Sleeping
Sleeping
jorgenlybeck
commited on
Commit
•
4f382e8
1
Parent(s):
7c6657d
add more example
Browse files- app.py +3 -4
- examples/bear_or_wolverine.jpg +0 -0
app.py
CHANGED
@@ -2,14 +2,13 @@ __all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples'
|
|
2 |
|
3 |
from fastai.vision.all import *
|
4 |
import gradio as gr
|
5 |
-
import timm
|
6 |
|
7 |
# Some magic according to https://forums.fast.ai/t/lesson-2-official-topic/96033/376?page=17
|
8 |
-
def
|
9 |
return x[0].isupper() # Used by model
|
10 |
|
11 |
import sys
|
12 |
-
sys.modules["__main__"].
|
13 |
|
14 |
# Upload your model
|
15 |
learn = load_learner('model.pkl')
|
@@ -24,7 +23,7 @@ image = gr.Image()
|
|
24 |
label = gr.Label()
|
25 |
|
26 |
# Upload your own images and link them
|
27 |
-
examples = ['./examples/wolverine.jpg', './examples/bear.jpg']
|
28 |
|
29 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
30 |
intf.launch()
|
|
|
2 |
|
3 |
from fastai.vision.all import *
|
4 |
import gradio as gr
|
|
|
5 |
|
6 |
# Some magic according to https://forums.fast.ai/t/lesson-2-official-topic/96033/376?page=17
|
7 |
+
def is_wolverine(x):
|
8 |
return x[0].isupper() # Used by model
|
9 |
|
10 |
import sys
|
11 |
+
sys.modules["__main__"].is_wolverine = is_wolverine
|
12 |
|
13 |
# Upload your model
|
14 |
learn = load_learner('model.pkl')
|
|
|
23 |
label = gr.Label()
|
24 |
|
25 |
# Upload your own images and link them
|
26 |
+
examples = ['./examples/wolverine.jpg', './examples/bear.jpg', './examples/bear_or_wolverine.jpg']
|
27 |
|
28 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
29 |
intf.launch()
|
examples/bear_or_wolverine.jpg
ADDED