Spaces:
Runtime error
Runtime error
let's deploy to huggingface spaces
Browse files- Berner_Sennenhund.jpg +3 -0
- Kartaeuser.jpg +3 -0
- Muffin.jpg +3 -0
- app.py +27 -0
- bird.jpg +3 -0
- giraffe.jpg +3 -0
- horse.jpg +3 -0
- mouse.jpg +3 -0
- multiclassmodel.pkl +3 -0
- requirements.txt +2 -0
Berner_Sennenhund.jpg
ADDED
Git LFS Details
|
Kartaeuser.jpg
ADDED
Git LFS Details
|
Muffin.jpg
ADDED
Git LFS Details
|
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastbook import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
learn = load_learner('multiclassmodel.pkl')
|
5 |
+
|
6 |
+
labels = learn.dls.vocab
|
7 |
+
labels
|
8 |
+
|
9 |
+
def predict(img):
|
10 |
+
img = PILImage.create(img)
|
11 |
+
pred, pred_idx,probs = learn.predict(img)
|
12 |
+
return{labels[i]: float(probs[i]) for i in range(len(labels))}
|
13 |
+
|
14 |
+
title = "Demo Klassifikator für Vögel, Kuchen, Katzen, Hunde, Elefanten und Mäuse"
|
15 |
+
description = "Mit fast.ai auf Basis von zufällig heruntergeladenen Bildern aus dem Internet erstellter Klassifikator für die im Titel genannten Klassen"
|
16 |
+
article = "<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
|
17 |
+
examples = ['Berner_Sennenhund.jpg', 'bird.jpg','horse.jpg', 'Kartaeuser.jpg', 'mouse.jpg', 'Muffin.jpg']
|
18 |
+
interpretation = 'default'
|
19 |
+
|
20 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3),
|
21 |
+
title=title, description=description, article=article,examples=examples,interpretation=interpretation, enable_queue=True
|
22 |
+
).launch(share=True)
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
+
|
bird.jpg
ADDED
Git LFS Details
|
giraffe.jpg
ADDED
Git LFS Details
|
horse.jpg
ADDED
Git LFS Details
|
mouse.jpg
ADDED
Git LFS Details
|
multiclassmodel.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b9926f628f0f8c5f7b62412bd2004d1a975e0b37133a80a3629f40799c696ab1
|
3 |
+
size 46969711
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
scikit-image
|