vishalbakshi commited on
Commit
d6e7dc7
1 Parent(s): aad5d7e

clamp probability to 0.0-1.0

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. model.pkl +0 -3
app.py CHANGED
@@ -43,7 +43,8 @@ def predict_image(img):
43
  img = img.convert("L")
44
  img = img.resize((28, 28))
45
  img = np.array(img)
46
- return f"{learn.predict(img)[0][0]:.2f}"
 
47
 
48
  @app.post("/predict")
49
  async def predict(data: ImageData):
 
43
  img = img.convert("L")
44
  img = img.resize((28, 28))
45
  img = np.array(img)
46
+ pred = np.clip(learn.predict(img)[0][0], 0.0, 1.0)
47
+ return f"{pred:.2f}"
48
 
49
  @app.post("/predict")
50
  async def predict(data: ImageData):
model.pkl DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:04a212a1709f207d4f3c33a3ccd17d891df6917fe1ec1d7b0c1c918579b67df3
3
- size 89750534