Spaces:
Sleeping
Sleeping
Commit
·
c46c94f
1
Parent(s):
71562cb
Second commit
Browse files- .ipynb_checkpoints/Untitled-checkpoint.ipynb +6 -0
- Untitled.ipynb +33 -0
- app.py +20 -4
- model.pkl +3 -0
.ipynb_checkpoints/Untitled-checkpoint.ipynb
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [],
|
3 |
+
"metadata": {},
|
4 |
+
"nbformat": 4,
|
5 |
+
"nbformat_minor": 5
|
6 |
+
}
|
Untitled.ipynb
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": null,
|
6 |
+
"id": "83eb7185",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [],
|
9 |
+
"source": []
|
10 |
+
}
|
11 |
+
],
|
12 |
+
"metadata": {
|
13 |
+
"kernelspec": {
|
14 |
+
"display_name": "Python 3 (ipykernel)",
|
15 |
+
"language": "python",
|
16 |
+
"name": "python3"
|
17 |
+
},
|
18 |
+
"language_info": {
|
19 |
+
"codemirror_mode": {
|
20 |
+
"name": "ipython",
|
21 |
+
"version": 3
|
22 |
+
},
|
23 |
+
"file_extension": ".py",
|
24 |
+
"mimetype": "text/x-python",
|
25 |
+
"name": "python",
|
26 |
+
"nbconvert_exporter": "python",
|
27 |
+
"pygments_lexer": "ipython3",
|
28 |
+
"version": "3.11.3"
|
29 |
+
}
|
30 |
+
},
|
31 |
+
"nbformat": 4,
|
32 |
+
"nbformat_minor": 5
|
33 |
+
}
|
app.py
CHANGED
@@ -1,9 +1,25 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
4 |
-
def
|
5 |
-
return "Hello " + name + "1"
|
6 |
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
|
5 |
+
def is_cat(x): return
|
|
|
6 |
|
7 |
|
8 |
+
learn = load_learner('model.pkl')
|
9 |
+
|
10 |
+
categories = ('Dog', 'Cat')
|
11 |
+
|
12 |
+
|
13 |
+
def classify_image(img):
|
14 |
+
pred, pred_idx, probs = learn.predict(img)
|
15 |
+
return dict(zip(categories, map(float, probs)))
|
16 |
+
|
17 |
+
|
18 |
+
image = gr.inputs.Image(shape=(192, 192))
|
19 |
+
label = gr.outputs.Label()
|
20 |
+
examples = ["dog.jpg", "cat.jpg", "dunno.jpg"]
|
21 |
+
|
22 |
+
|
23 |
+
iface = gr.Interface(fn=classify_image, inputs=image,
|
24 |
+
outputs=label, examples=examples)
|
25 |
+
iface.launch(inline=False)
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:106a4d704e07b7ef014ca8a9c12599b48bfceb54fd41c4c2a0712c52003c897c
|
3 |
+
size 47063121
|