Spaces:
Sleeping
Sleeping
Commit ·
57476e1
1
Parent(s): f3a1d56
"Done"
Browse files- .ipynb_checkpoints/app-checkpoint.ipynb +56 -0
- app.ipynb +0 -0
- app.py +25 -4
- app/app.py +28 -0
- black.jpg +0 -0
- bpp/app.py +28 -0
- grizzly.jpeg +0 -0
- model.pkl +3 -0
- teddy.jpg +0 -0
.ipynb_checkpoints/app-checkpoint.ipynb
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": null,
|
| 6 |
+
"id": "8f87b679",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [],
|
| 9 |
+
"source": [
|
| 10 |
+
"pip install fastai\n",
|
| 11 |
+
"pip install gradio"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "code",
|
| 16 |
+
"execution_count": 1,
|
| 17 |
+
"id": "f2458b29",
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"outputs": [],
|
| 20 |
+
"source": [
|
| 21 |
+
"#|default_exp app\n"
|
| 22 |
+
]
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"cell_type": "code",
|
| 26 |
+
"execution_count": null,
|
| 27 |
+
"id": "79013522",
|
| 28 |
+
"metadata": {},
|
| 29 |
+
"outputs": [],
|
| 30 |
+
"source": [
|
| 31 |
+
"#|export\n"
|
| 32 |
+
]
|
| 33 |
+
}
|
| 34 |
+
],
|
| 35 |
+
"metadata": {
|
| 36 |
+
"kernelspec": {
|
| 37 |
+
"display_name": "Python 3 (ipykernel)",
|
| 38 |
+
"language": "python",
|
| 39 |
+
"name": "python3"
|
| 40 |
+
},
|
| 41 |
+
"language_info": {
|
| 42 |
+
"codemirror_mode": {
|
| 43 |
+
"name": "ipython",
|
| 44 |
+
"version": 3
|
| 45 |
+
},
|
| 46 |
+
"file_extension": ".py",
|
| 47 |
+
"mimetype": "text/x-python",
|
| 48 |
+
"name": "python",
|
| 49 |
+
"nbconvert_exporter": "python",
|
| 50 |
+
"pygments_lexer": "ipython3",
|
| 51 |
+
"version": "3.10.6"
|
| 52 |
+
}
|
| 53 |
+
},
|
| 54 |
+
"nbformat": 4,
|
| 55 |
+
"nbformat_minor": 5
|
| 56 |
+
}
|
app.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
app.py
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def greet(name):
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
| 2 |
+
|
| 3 |
+
# %% auto 0
|
| 4 |
+
__all__ = ['model', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
| 5 |
+
|
| 6 |
+
# %% ../app.ipynb 3
|
| 7 |
+
from fastai.vision.all import *
|
| 8 |
+
|
| 9 |
import gradio as gr
|
| 10 |
|
|
|
|
|
|
|
| 11 |
|
| 12 |
+
# %% ../app.ipynb 6
|
| 13 |
+
model=load_learner('model.pkl')
|
| 14 |
+
|
| 15 |
+
# %% ../app.ipynb 8
|
| 16 |
+
categories = ('black', 'grizzly','teddy')
|
| 17 |
+
|
| 18 |
+
def classify_image(img):
|
| 19 |
+
pred, idx, probs = model.predict(img)
|
| 20 |
+
return dict(zip(categories, map (float,probs)))
|
| 21 |
+
|
| 22 |
+
# %% ../app.ipynb 10
|
| 23 |
+
image= gr.inputs.Image(shape=(192, 192))
|
| 24 |
+
label= gr.outputs.Label()
|
| 25 |
+
examples =['black.jpg', 'teddy.jpg']
|
| 26 |
+
|
| 27 |
+
intf= gr.Interface(fn =classify_image, inputs= image, outputs= label, Examples= examples)
|
| 28 |
+
intf.launch(inline=False, share=True, debug=True)
|
app/app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
| 2 |
+
|
| 3 |
+
# %% auto 0
|
| 4 |
+
__all__ = ['model', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
| 5 |
+
|
| 6 |
+
# %% ../app.ipynb 3
|
| 7 |
+
from fastai.vision.all import *
|
| 8 |
+
|
| 9 |
+
import gradio as gr
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# %% ../app.ipynb 6
|
| 13 |
+
model=load_learner('model.pkl')
|
| 14 |
+
|
| 15 |
+
# %% ../app.ipynb 8
|
| 16 |
+
categories = ('black', 'grizzly','teddy')
|
| 17 |
+
|
| 18 |
+
def classify_image(img):
|
| 19 |
+
pred, idx, probs = model.predict(img)
|
| 20 |
+
return dict(zip(categories, map (float,probs)))
|
| 21 |
+
|
| 22 |
+
# %% ../app.ipynb 10
|
| 23 |
+
image= gr.inputs.Image(shape=(192, 192))
|
| 24 |
+
label= gr.outputs.Label()
|
| 25 |
+
examples =['black.jpg', 'teddy.jpg']
|
| 26 |
+
|
| 27 |
+
intf= gr.Interface(fn =classify_image, inputs= image, outputs= label, Examples= examples)
|
| 28 |
+
intf.launch(inline=False, share=True, debug=True)
|
black.jpg
ADDED
|
bpp/app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
| 2 |
+
|
| 3 |
+
# %% auto 0
|
| 4 |
+
__all__ = ['model', 'categories', 'image', 'label', 'examples', 'intf', 'classify_image']
|
| 5 |
+
|
| 6 |
+
# %% ../app.ipynb 3
|
| 7 |
+
from fastai.vision.all import *
|
| 8 |
+
|
| 9 |
+
import gradio as gr
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# %% ../app.ipynb 6
|
| 13 |
+
model=load_learner('model.pkl')
|
| 14 |
+
|
| 15 |
+
# %% ../app.ipynb 8
|
| 16 |
+
categories = ('black', 'grizzly','teddy')
|
| 17 |
+
|
| 18 |
+
def classify_image(img):
|
| 19 |
+
pred, idx, probs = model.predict(img)
|
| 20 |
+
return dict(zip(categories, map (float,probs)))
|
| 21 |
+
|
| 22 |
+
# %% ../app.ipynb 10
|
| 23 |
+
image= gr.inputs.Image(shape=(192, 192))
|
| 24 |
+
label= gr.outputs.Label()
|
| 25 |
+
examples =['/content/black.jpg', '/content/grizzly.jpg', '/content/teddy.jpg']
|
| 26 |
+
|
| 27 |
+
intf= gr.Interface(fn =classify_image, inputs= image, outputs= label, Examples= examples)
|
| 28 |
+
intf.launch(inline=False, share=True, debug=True)
|
grizzly.jpeg
ADDED
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e86d9f2c10ec40a15cadd4ca5f59fca23ee66a134bbaed6d14781e0b67429641
|
| 3 |
+
size 46973327
|
teddy.jpg
ADDED
|