scikit-image fix
Browse files- __pycache__/app.cpython-310.pyc +0 -0
- app.py +14 -6
- model.pkl +2 -2
- 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):
|
|
|
|
|
|
|
| 7 |
|
| 8 |
learn = load_learner("model.pkl")
|
| 9 |
|
| 10 |
labels = learn.dls.vocab
|
| 11 |
|
|
|
|
| 12 |
def predict(img):
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
-
gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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:
|
| 3 |
-
size
|
|
|
|
| 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
|