Spaces:
Runtime error
Runtime error
Commit
·
e1aa5c6
1
Parent(s):
62b64c1
Add application file
Browse files- app.py +15 -0
- model.pkl +3 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
learn = load_learner('model.pkl')
|
| 4 |
+
|
| 5 |
+
categories = ('Dog', 'Cat')
|
| 6 |
+
|
| 7 |
+
def classify_image(img):
|
| 8 |
+
pred,idx,probs = learn.predict(img)
|
| 9 |
+
return dict(zip(categories, map(float, probs)))
|
| 10 |
+
|
| 11 |
+
image = gr.inputs.Image(shape=(192, 192))
|
| 12 |
+
label = gr.outputs.Label()
|
| 13 |
+
|
| 14 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
|
| 15 |
+
intf.launch()
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:83f1f56dac67fb62b7d8d4ff27723740e61066286d0266628fba83860ee308da
|
| 3 |
+
size 47061419
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
fastai
|