Sajjad313 commited on
Commit
d984a6a
·
1 Parent(s): b3e13a2

replacing new model

Browse files
app.py CHANGED
@@ -1,25 +1,15 @@
1
- from fastai.vision.all import *
2
- from fastcore.all import *
3
- import pickle
4
 
5
- learn = load_learner(
6
- 'resnet18_bearclassifier.pkl',
7
- pickle_module={
8
- 'pickle_module': pickle,
9
- 'map_location': lambda storage, loc: storage
10
- }
11
- )
12
-
13
- # gradio UI
14
 
 
 
15
 
16
  def classify_image(img):
17
  categories = ['brown', 'polar']
18
- _, _, probability = learn.predict(img)
19
  return dict(zip(categories, map(float, probability)))
20
 
21
-
22
- app = gr.Interface(fn=classify_image, inputs='image',
23
- outputs='label', examples=list(get_image_files('valid')))
24
  app.launch()
25
  classify_image('images.jpg')
 
1
+ from fastai.vision.all import load_learner, get_image_files
 
 
2
 
3
+ learn = load_learner('resnet18_bearclassifier.pkl')
 
 
 
 
 
 
 
 
4
 
5
+ #gradio UI
6
+ import gradio as gr
7
 
8
  def classify_image(img):
9
  categories = ['brown', 'polar']
10
+ _,_, probability = learn.predict(img)
11
  return dict(zip(categories, map(float, probability)))
12
 
13
+ app = gr.Interface(fn=classify_image, inputs='image', outputs='label', examples= list(get_image_files('valid')))
 
 
14
  app.launch()
15
  classify_image('images.jpg')
resnet18_bearclassifier.pkl → resnet18_bearclassifier_lunux.pkl RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:00bce8ac5b8c770c019669f9a92fea24b99c1742d0b8d3eeae852d898040cc01
3
- size 46965914
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a393751fe74333b62f1c300803d388df75d23f1e317f69d716cfe6f42397dabd
3
+ size 46967194