Rahuletto commited on
Commit
cc0bcc8
·
1 Parent(s): e93d31b

init: First ever vision project

Browse files
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ models/create.ipynb
2
+ images
3
+ classify.ipynb
README.md CHANGED
@@ -5,10 +5,10 @@ colorFrom: purple
5
  colorTo: indigo
6
  sdk: gradio
7
  sdk_version: 5.8.0
8
- app_file: app.py
9
  pinned: false
10
  license: apache-2.0
11
- short_description: Classfies car brands with image
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
5
  colorTo: indigo
6
  sdk: gradio
7
  sdk_version: 5.8.0
8
+ app_file: classify.py
9
  pinned: false
10
  license: apache-2.0
11
+ short_description: Classfies car brands with image using fast.ai
12
  ---
13
 
14
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
classify.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: classify.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'image', 'label', 'examples', 'intf', 'classify_car']
5
+
6
+ # %% classify.ipynb 1
7
+ from fastbook import *
8
+ import gradio as gr
9
+
10
+ # %% classify.ipynb 3
11
+ learn=load_learner('models/car_classifier.pkl')
12
+
13
+ # %% classify.ipynb 5
14
+ def classify_car(img):
15
+ img = PILImage.create(img)
16
+ pred, pred_idx, probs = learn.predict(img)
17
+
18
+ return {learn.dls.vocab[i]: probs[i].item() for i in range(len(learn.dls.vocab))}
19
+
20
+ # %% classify.ipynb 6
21
+ image=gr.components.Image()
22
+ label=gr.components.Label()
23
+ examples=[['examples/example_0.png'], ['examples/example_1.png'], ['examples/example_2.png']]
24
+ intf=gr.Interface(fn=classify_car, inputs=image, outputs=label, examples=examples).launch()
25
+ intf.inline=True
examples/example_0.png ADDED
examples/example_1.png ADDED
examples/example_2.png ADDED