Spaces:
Build error
Build error
app and model
Browse files- Rotifer_Classifier.pkl +3 -0
- app.py +25 -7
Rotifer_Classifier.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2e4b937ff13c1ed34a79ac9585993e12b7c31d62f605bccd18a85ac3f59e6474
|
3 |
+
size 114631857
|
app.py
CHANGED
@@ -1,7 +1,25 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'intf', 'classify_image']
|
5 |
+
|
6 |
+
# %% ../app.ipynb 1
|
7 |
+
from fastai.vision.all import *
|
8 |
+
import gradio as gr
|
9 |
+
|
10 |
+
# %% ../app.ipynb 3
|
11 |
+
learn = load_learner("Rotifer_Classifier.pkl")
|
12 |
+
|
13 |
+
# %% ../app.ipynb 5
|
14 |
+
categories = ("Bdelloid Rotifer", "Monogonont Rotifer")
|
15 |
+
|
16 |
+
def classify_image(img):
|
17 |
+
pred, idx, probs = learn.predict(img)
|
18 |
+
return dict(zip(categories, map(float,probs)))
|
19 |
+
|
20 |
+
# %% ../app.ipynb 7
|
21 |
+
image = gr.inputs.Image(shape=(192,192))
|
22 |
+
label = gr.outputs.Label()
|
23 |
+
|
24 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
|
25 |
+
intf.launch(inline=False)
|