newgnart commited on
Commit
afc2743
·
1 Parent(s): 24e6e7e
app.py CHANGED
@@ -2,21 +2,23 @@ from fastai.vision.all import *
2
  import gradio as gr
3
  import timm
4
 
5
- # Cell
6
- learn = load_learner('model.pkl')
7
 
8
- # Cell
9
  categories = learn.dls.vocab
10
 
 
11
  def classify_image(img):
12
- pred,idx,probs = learn.predict(img)
13
- return dict(zip(categories, map(float,probs)))
 
14
 
15
- # Cell
16
  image = gr.inputs.Image(shape=(192, 192))
17
  label = gr.outputs.Label()
18
- examples = ['bong.jpeg']
 
 
 
 
19
 
20
- # Cell
21
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
22
- intf.launch()
 
2
  import gradio as gr
3
  import timm
4
 
5
+ learn = load_learner("model.pkl")
 
6
 
 
7
  categories = learn.dls.vocab
8
 
9
+
10
  def classify_image(img):
11
+ pred, idx, probs = learn.predict(img)
12
+ return dict(zip(categories, map(float, probs)))
13
+
14
 
 
15
  image = gr.inputs.Image(shape=(192, 192))
16
  label = gr.outputs.Label()
17
+ examples = [
18
+ "example_photos/altocumulus.jpg",
19
+ "example_photos/lenticular.jpg",
20
+ "example_photos/cirrocumulus.jpg",
21
+ ]
22
 
 
23
  intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
24
+ intf.launch()
bong.jpeg DELETED

Git LFS Details

  • SHA256: b1c7acb8f74640a9a3bd4f3f33adf1da8c83b3a6ebbfa465fee872e13abd3e3f
  • Pointer size: 132 Bytes
  • Size of remote file: 2.88 MB
example_photos/altocumulus.jpg ADDED
example_photos/cirrocumulus.jpg ADDED
example_photos/lenticular.jpg ADDED
model.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8422d6d41d797411e391c7fab3441207d065d3538315ca615956598a3a6f6488
3
- size 114793249
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34c77e03abb5cedec651ff4ad94a81657c6a5195f07754979b4282e7cd7caee8
3
+ size 46961485
requirements.txt CHANGED
@@ -1,5 +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
 
1
  fastai==2.7.12
2
+ gradio==3.37.0
3
  timm==0.9.2
4
  torch==2.0.1
5
  torchvision==0.15.2