Spaces:
Runtime error
Runtime error
The last try of the day
Browse files
app.py
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
from fastai.vision.all import *
|
| 2 |
-
from huggingface_hub import push_to_hub_fastai, from_pretrained_fastai
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
-
|
| 6 |
-
learn = from_pretrained_fastai(repo_id)
|
| 7 |
|
| 8 |
|
| 9 |
-
|
| 10 |
|
| 11 |
-
def
|
| 12 |
-
|
| 13 |
-
|
|
|
|
| 14 |
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
examples=['
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
intf.launch()
|
|
|
|
| 1 |
from fastai.vision.all import *
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
learn = load_learner('export.pkl')
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
+
labels = learn.dls.vocab
|
| 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 |
|
| 15 |
+
title = "Car classifier"
|
| 16 |
+
description = "A car classifier in which I've being spending so much time to make a working prototype online"
|
| 17 |
+
examples = ['lamborghini.jpg', 'koenigsegg.jpg', '']
|
| 18 |
+
interpretation='default'
|
| 19 |
+
enable_queue=True
|
| 20 |
|
| 21 |
+
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
|
|
|