stehrt commited on
Commit
50586eb
·
1 Parent(s): 0b97734

3rd commit

Browse files
Files changed (8) hide show
  1. README.md +7 -7
  2. app.ipynb +0 -0
  3. app.py +27 -0
  4. basset.jpg +0 -0
  5. gitignore.txt +3 -0
  6. model.pkl +3 -0
  7. requirements.txt +5 -0
  8. train.ipynb +0 -0
README.md CHANGED
@@ -1,13 +1,13 @@
1
  ---
2
- title: Cat Categories
3
- emoji: 🏃
4
- colorFrom: green
5
- colorTo: purple
6
  sdk: gradio
7
- sdk_version: 3.35.2
8
  app_file: app.py
9
- pinned: false
10
  license: apache-2.0
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Pet classifier!
3
+ emoji: 🐶
4
+ colorFrom: pink
5
+ colorTo: blue
6
  sdk: gradio
7
+ sdk_version: 3.1.1
8
  app_file: app.py
9
+ pinned: true
10
  license: apache-2.0
11
  ---
12
 
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces#reference
app.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: . (unless otherwise specified).
2
+
3
+ __all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
4
+
5
+ # Cell
6
+ from fastai.vision.all import *
7
+ import gradio as gr
8
+ import timm
9
+
10
+ # Cell
11
+ learn = load_learner('model.pkl')
12
+
13
+ # Cell
14
+ categories = learn.dls.vocab
15
+
16
+ def classify_image(img):
17
+ pred,idx,probs = learn.predict(img)
18
+ return dict(zip(categories, map(float,probs)))
19
+
20
+ # Cell
21
+ image = gr.inputs.Image(shape=(192, 192))
22
+ label = gr.outputs.Label()
23
+ examples = ['basset.jpg']
24
+
25
+ # Cell
26
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
27
+ intf.launch()
basset.jpg ADDED
gitignore.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ flagged/
2
+ .ipynb_checkpoints/
3
+
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8422d6d41d797411e391c7fab3441207d065d3538315ca615956598a3a6f6488
3
+ size 114793249
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ fastai==2.7.12
2
+ gradio==3.34.0
3
+ timm==0.9.2
4
+ torch==2.0.1
5
+ torchvision==0.15.2
train.ipynb ADDED
The diff for this file is too large to render. See raw diff