Spaces:
Runtime error
Runtime error
Initial commit
Browse files- .gitattributes +1 -0
- app.py +15 -0
- export.pkl +3 -0
- fetuccini.jpeg +0 -0
- fusilli.jpeg +0 -0
- lasagna.jpeg +0 -0
- orzo.jpeg +0 -0
- radiatori.jpeg +0 -0
.gitattributes
CHANGED
@@ -29,3 +29,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
32 |
+
export.pkl filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastcore.all import *
|
3 |
+
from fastai.vision.all import *
|
4 |
+
|
5 |
+
learn = load_learner('export.pkl')
|
6 |
+
labels = learn.dls.vocab
|
7 |
+
def predict(img):
|
8 |
+
img = PILImage.create(img)
|
9 |
+
pred,pred_idx,probs = learn.predict(img)
|
10 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
11 |
+
|
12 |
+
examples = ['radiatori.jpeg', 'fusilli.jpeg', 'fetuccini.jpeg', 'lasagna.jpeg', 'orzo.jpeg']
|
13 |
+
|
14 |
+
description = "# π PASTA MACHINE π - the pasta AI"
|
15 |
+
gr.Interface(fn=predict, description=description, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3), examples=examples).launch(share=True)
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8684e8fd6ad71562aa836c27d6a6441c6bd3ae4f602cef250dee226b0e302894
|
3 |
+
size 179328551
|
fetuccini.jpeg
ADDED
![]() |
fusilli.jpeg
ADDED
![]() |
lasagna.jpeg
ADDED
![]() |
orzo.jpeg
ADDED
![]() |
radiatori.jpeg
ADDED
![]() |