segadeds commited on
Commit
a717b41
·
verified ·
1 Parent(s): 7504c67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from fastai.vision.all import *
2
  import gradio as gr
 
3
 
4
 
5
  learn = load_learner('model.pkl')
@@ -12,6 +13,7 @@ categories = (['calling', 'clapping', 'cycling', 'dancing', 'drinking', 'eating'
12
 
13
 
14
  def classify_image(img):
 
15
  img = PILImage.create(img).resize((192, 192))
16
  pred,idx,probs = learn.predict(img)
17
  return dict(zip(categories, map(float,probs)))
 
1
  from fastai.vision.all import *
2
  import gradio as gr
3
+ import numpy as np
4
 
5
 
6
  learn = load_learner('model.pkl')
 
13
 
14
 
15
  def classify_image(img):
16
+ img = np.array(img)
17
  img = PILImage.create(img).resize((192, 192))
18
  pred,idx,probs = learn.predict(img)
19
  return dict(zip(categories, map(float,probs)))