teamtom commited on
Commit
523af2e
·
1 Parent(s): dbc3bb4
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -6,12 +6,12 @@ import pathlib, os
6
  classes = ['rock', 'paper', 'scissors'] # c0, c1, c2
7
 
8
  def classify_image(img, model):
9
- # if os.name == 'nt': # workaround for Windows
10
- # pathlib.PosixPath = pathlib.WindowsPath
11
- # if os.name == 'posix': # workaround for Linux
12
- # pathlib.WindowsPath = pathlib.PosixPath
13
 
14
- learn = load_learner(model)
15
  pred,idx,probs = learn.predict(img)
16
  return dict(zip(classes, map(float, probs)))
17
 
 
6
  classes = ['rock', 'paper', 'scissors'] # c0, c1, c2
7
 
8
  def classify_image(img, model):
9
+ if os.name == 'nt': # workaround for Windows
10
+ pathlib.PosixPath = pathlib.WindowsPath
11
+ if os.name == 'posix': # workaround for Linux
12
+ pathlib.WindowsPath = pathlib.PosixPath
13
 
14
+ learn = load_learner(model, cpu=True)
15
  pred,idx,probs = learn.predict(img)
16
  return dict(zip(classes, map(float, probs)))
17