Spaces:
Sleeping
Sleeping
Deep
commited on
Commit
·
f617acd
1
Parent(s):
853e24c
model, interface, examples added
Browse files- README.md +5 -1
- app.py +38 -1
- models/car-recognizer-v0.pkl +3 -0
- test_images/00.jpg +0 -0
- test_images/bus.jpg +0 -0
- test_images/minivan.jpg +0 -0
- test_images/muscle.jpg +0 -0
- test_images/musclecar.jpg +0 -0
- test_images/sedan.jpg +0 -0
- test_images/sports.jpg +0 -0
- test_images/suv.jpg +0 -0
- test_images/truck.jpg +0 -0
README.md
CHANGED
|
@@ -10,4 +10,8 @@ pinned: false
|
|
| 10 |
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
license: mit
|
| 11 |
---
|
| 12 |
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference <br>
|
| 14 |
+
|
| 15 |
+
HuggingFace Spaces App URL: https://huggingface.co/spaces/sheikhDeep/car-recognizer
|
| 16 |
+
|
| 17 |
+
Gradio App URL: https://d4b0997d-695f-4d75.gradio.live/
|
app.py
CHANGED
|
@@ -1,7 +1,44 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
def greet(name):
|
| 4 |
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
iface.launch()
|
|
|
|
| 1 |
+
from fastai.vision.all import load_learner
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
|
| 5 |
+
car_labels = [
|
| 6 |
+
'Bus',
|
| 7 |
+
'Convertible',
|
| 8 |
+
'Hatchback',
|
| 9 |
+
'Limousine',
|
| 10 |
+
'Micro',
|
| 11 |
+
'Minivan',
|
| 12 |
+
'Muscle car',
|
| 13 |
+
'Sedan',
|
| 14 |
+
'Sports car',
|
| 15 |
+
'SUV',
|
| 16 |
+
'Truck'
|
| 17 |
+
]
|
| 18 |
+
|
| 19 |
+
model = load_learner('models/car-recognizer-v0.pkl')
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def recognize_image(image):
|
| 23 |
+
pred, idx, probs = model.predict(image)
|
| 24 |
+
return dict(zip(car_labels, map(float, probs)))
|
| 25 |
+
|
| 26 |
def greet(name):
|
| 27 |
return "Hello " + name + "!!"
|
| 28 |
|
| 29 |
+
|
| 30 |
+
image = gr.inputs.Image(shape=(192, 192))
|
| 31 |
+
label = gr.outputs.Label()
|
| 32 |
+
examples = [
|
| 33 |
+
'test_images/00.jpg',
|
| 34 |
+
'test_images/bus.jpg',
|
| 35 |
+
'test_images/minivan.jpg',
|
| 36 |
+
'test_images/musclecar.jpg',
|
| 37 |
+
'test_images/sedan.jpg',
|
| 38 |
+
'test_images/sports.jpg',
|
| 39 |
+
'test_images/suv.jpg',
|
| 40 |
+
'test_images/truck.jpg'
|
| 41 |
+
]
|
| 42 |
+
|
| 43 |
+
iface = gr.Interface(fn=recognize_image, inputs=image, outputs=label, examples=examples)
|
| 44 |
iface.launch()
|
models/car-recognizer-v0.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:009f7ef2ca935530d1f20aa86b5591e92f3a2d1dcc8f43fac74ba72178eabbae
|
| 3 |
+
size 102940301
|
test_images/00.jpg
ADDED
|
test_images/bus.jpg
ADDED
|
test_images/minivan.jpg
ADDED
|
test_images/muscle.jpg
ADDED
|
test_images/musclecar.jpg
ADDED
|
test_images/sedan.jpg
ADDED
|
test_images/sports.jpg
ADDED
|
test_images/suv.jpg
ADDED
|
test_images/truck.jpg
ADDED
|