Spaces:
Runtime error
Runtime error
Commit
·
d3382db
1
Parent(s):
da16dba
change
Browse files
app.py
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
|
|
| 1 |
from fastai.vision.all import load_learner, get_image_files
|
| 2 |
|
| 3 |
-
learn = load_learner('
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
#gradio UI
|
| 6 |
-
import gradio as gr
|
| 7 |
|
| 8 |
def classify_image(img):
|
| 9 |
categories = ['brown', 'polar']
|
| 10 |
-
_,_, probability = learn.predict(img)
|
| 11 |
return dict(zip(categories, map(float, probability)))
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
| 14 |
app.launch()
|
| 15 |
classify_image('images.jpg')
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
from fastai.vision.all import load_learner, get_image_files
|
| 3 |
|
| 4 |
+
learn = load_learner('resnet18_bearclassifier_linux.pkl')
|
| 5 |
+
|
| 6 |
+
# gradio UI
|
| 7 |
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def classify_image(img):
|
| 10 |
categories = ['brown', 'polar']
|
| 11 |
+
_, _, probability = learn.predict(img)
|
| 12 |
return dict(zip(categories, map(float, probability)))
|
| 13 |
|
| 14 |
+
|
| 15 |
+
app = gr.Interface(fn=classify_image, inputs='image',
|
| 16 |
+
outputs='label', examples=list(get_image_files('valid')))
|
| 17 |
app.launch()
|
| 18 |
classify_image('images.jpg')
|
resnet18_bearclassifier_lunux.pkl → resnet18_bearclassifier_linux.pkl
RENAMED
|
File without changes
|