dougfulop commited on
Commit
2ad0d61
·
1 Parent(s): 3a1602f

scikit-image fix

Browse files
Files changed (4) hide show
  1. __pycache__/app.cpython-310.pyc +0 -0
  2. app.py +14 -6
  3. model.pkl +2 -2
  4. model_old.pkl +3 -0
__pycache__/app.cpython-310.pyc CHANGED
Binary files a/__pycache__/app.cpython-310.pyc and b/__pycache__/app.cpython-310.pyc differ
 
app.py CHANGED
@@ -1,17 +1,25 @@
1
  import gradio as gr
 
2
  import skimage
3
 
4
- from fastai.vision.all import *
5
 
6
- def is_cat(x): return x[0].isupper()
 
 
7
 
8
  learn = load_learner("model.pkl")
9
 
10
  labels = learn.dls.vocab
11
 
 
12
  def predict(img):
13
- img = PILImage.create(img)
14
- pred, pred_idx, probs = learn.predict(img)
15
- return {labels[i]: float(probs[i]) for i in range(len(probs))}
 
16
 
17
- gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
 
 
 
 
 
1
  import gradio as gr
2
+ from fastai.vision.all import *
3
  import skimage
4
 
 
5
 
6
+ def is_cat(x):
7
+ return x[0].isupper()
8
+
9
 
10
  learn = load_learner("model.pkl")
11
 
12
  labels = learn.dls.vocab
13
 
14
+
15
  def predict(img):
16
+ img = PILImage.create(img)
17
+ pred, pred_idx, probs = learn.predict(img)
18
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
19
+
20
 
21
+ gr.Interface(
22
+ fn=predict,
23
+ inputs=gr.inputs.Image(shape=(512, 512)),
24
+ outputs=gr.outputs.Label(num_top_classes=3),
25
+ ).launch(share=False)
model.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3feaa3b412eafba8ee50477b593457c5c8aa1316f66e89ba7f8509297cddc2e5
3
- size 47063121
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:52cb93d63d9e5c72b8dbb44c50a674968105d6251adb8136cce0df34f6407ba5
3
+ size 47061483
model_old.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3feaa3b412eafba8ee50477b593457c5c8aa1316f66e89ba7f8509297cddc2e5
3
+ size 47063121