Donald Kapyouo commited on
Commit
1f08ab2
·
1 Parent(s): 4c3e12e

update code

Browse files
Files changed (2) hide show
  1. app.py +5 -5
  2. requirements.txt +1 -2
app.py CHANGED
@@ -3,15 +3,15 @@ from fastai.vision.all import *
3
 
4
  def is_cat(x): return x[0].isupper()
5
 
6
- learn = load_learner('model.pkl')
7
 
8
- categories = ['cat', 'dog']
9
 
10
  def predict_image(img):
11
  pred, pred_idx, probs = learn.predict(img)
12
  return dict(zip(categories, map(float, probs)))
13
 
14
- image = gr.inputs.Image(shape=(192, 192))
15
- label = gr.outputs.Label()
16
  examples = ["cat.jpg", "dog.jpg"]
17
- gr.Interface(fn=predict_image, inputs=image, outputs=label, capture_session=True).launch()
 
3
 
4
  def is_cat(x): return x[0].isupper()
5
 
6
+ learn = load_learner('model2.pkl')
7
 
8
+ categories = ['dog', 'cat']
9
 
10
  def predict_image(img):
11
  pred, pred_idx, probs = learn.predict(img)
12
  return dict(zip(categories, map(float, probs)))
13
 
14
+ image = gr.Image()
15
+ label = gr.Label()
16
  examples = ["cat.jpg", "dog.jpg"]
17
+ gr.Interface(fn=predict_image, inputs=image, outputs=label).launch()
requirements.txt CHANGED
@@ -1,2 +1 @@
1
- fastai
2
- gradio
 
1
+ fastai