Spaces:
Build error
Build error
trying
Browse files
app.py
CHANGED
|
@@ -5,13 +5,13 @@ import pathlib, os
|
|
| 5 |
|
| 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 |
|
|
|
|
| 5 |
|
| 6 |
classes = ['rock', 'paper', 'scissors'] # c0, c1, c2
|
| 7 |
|
| 8 |
+
def classify_image(img, model='rock-paper-scissors-resnet34.pkl'):
|
| 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 |
|