Mel-Mac commited on
Commit
ce33464
·
verified ·
1 Parent(s): efabd91

New model, app file and requirements.txt

Browse files

all new files as first cat breed model experiment

Files changed (9) hide show
  1. README.md +1 -1
  2. app.py +27 -0
  3. bengal.jpg +0 -0
  4. maine_coon.jpg +0 -0
  5. model.pkl +3 -0
  6. ragdoll.jpg +0 -0
  7. requirements.txt +5 -0
  8. shorthair.jpg +0 -0
  9. siamese.jpg +0 -0
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 📉
4
  colorFrom: green
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 4.19.2
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
 
4
  colorFrom: green
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 3.43.1
8
  app_file: app.py
9
  pinned: false
10
  license: apache-2.0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../modelexport.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'cat_breed', 'classify_image']
5
+
6
+ # %% ../modelexport.ipynb 3
7
+ from fastai.vision.all import *
8
+ import gradio as gr
9
+
10
+ def cat_breed(x): return x[0].isupper()
11
+
12
+ # %% ../modelexport.ipynb 18
13
+ learn = load_learner('model.pkl')
14
+
15
+ categories = 'bengal','domestic_shorthair', 'maine_coon', 'ragdoll', 'siamese'
16
+
17
+ def classify_image(img):
18
+ pred,idx,probs = learn.predict(img)
19
+ return dict(zip(categories, map(float, probs)))
20
+
21
+ image = gr.inputs.Image(shape = (192,192))
22
+ label = gr.outputs.Label()
23
+ examples = ['bengal.jpg', 'shorthair.jpg','maine_coon.jpg','ragdoll.jpg','siamese.jpg']
24
+
25
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
26
+ intf.launch(inline=False)
27
+
bengal.jpg ADDED
maine_coon.jpg ADDED
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88cf94787045cf326ae6241b51b1c5cec4f851dc1de50147bca11bb87a0a4b6e
3
+ size 46979006
ragdoll.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ fastai
2
+ torch
3
+ gradio
4
+ numpy
5
+ pandas <2.0.0
shorthair.jpg ADDED
siamese.jpg ADDED