Spaces:
Sleeping
Sleeping
ellenzhangchang
commited on
Commit
•
d63b741
1
Parent(s):
710b225
add grizzle model
Browse files- .gitattributes +2 -0
- app.ipynb +424 -0
- app.py +29 -4
- export.pkl +3 -0
- images/black.png +3 -0
- images/grizzly.png +3 -0
- images/teddy.png +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
37 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
app.ipynb
ADDED
@@ -0,0 +1,424 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 21,
|
6 |
+
"id": "initial_id",
|
7 |
+
"metadata": {
|
8 |
+
"collapsed": true,
|
9 |
+
"ExecuteTime": {
|
10 |
+
"end_time": "2024-01-31T12:25:20.508204Z",
|
11 |
+
"start_time": "2024-01-31T12:25:14.887824Z"
|
12 |
+
}
|
13 |
+
},
|
14 |
+
"outputs": [
|
15 |
+
{
|
16 |
+
"name": "stdout",
|
17 |
+
"output_type": "stream",
|
18 |
+
"text": [
|
19 |
+
"Requirement already satisfied: pip in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (23.3.2)\r\n",
|
20 |
+
"Requirement already satisfied: gradio in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (3.43.1)\r\n",
|
21 |
+
"Requirement already satisfied: aiofiles<24.0,>=22.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (23.2.1)\r\n",
|
22 |
+
"Requirement already satisfied: altair<6.0,>=4.2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (5.2.0)\r\n",
|
23 |
+
"Requirement already satisfied: fastapi in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (0.109.0)\r\n",
|
24 |
+
"Requirement already satisfied: ffmpy in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (0.3.1)\r\n",
|
25 |
+
"Requirement already satisfied: gradio-client==0.5.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (0.5.0)\r\n",
|
26 |
+
"Requirement already satisfied: httpx in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (0.26.0)\r\n",
|
27 |
+
"Requirement already satisfied: huggingface-hub>=0.14.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (0.20.3)\r\n",
|
28 |
+
"Requirement already satisfied: importlib-resources<7.0,>=1.3 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (6.1.1)\r\n",
|
29 |
+
"Requirement already satisfied: jinja2<4.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (3.1.2)\r\n",
|
30 |
+
"Requirement already satisfied: markupsafe~=2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (2.1.2)\r\n",
|
31 |
+
"Requirement already satisfied: matplotlib~=3.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (3.8.2)\r\n",
|
32 |
+
"Requirement already satisfied: numpy~=1.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (1.24.3)\r\n",
|
33 |
+
"Requirement already satisfied: orjson~=3.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (3.9.12)\r\n",
|
34 |
+
"Requirement already satisfied: packaging in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (23.1)\r\n",
|
35 |
+
"Requirement already satisfied: pandas<3.0,>=1.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (2.0.2)\r\n",
|
36 |
+
"Requirement already satisfied: pillow<11.0,>=8.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (10.2.0)\r\n",
|
37 |
+
"Requirement already satisfied: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (2.6.0)\r\n",
|
38 |
+
"Requirement already satisfied: pydub in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (0.25.1)\r\n",
|
39 |
+
"Requirement already satisfied: python-multipart in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (0.0.6)\r\n",
|
40 |
+
"Requirement already satisfied: pyyaml<7.0,>=5.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (6.0)\r\n",
|
41 |
+
"Requirement already satisfied: requests~=2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (2.31.0)\r\n",
|
42 |
+
"Requirement already satisfied: semantic-version~=2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (2.10.0)\r\n",
|
43 |
+
"Requirement already satisfied: typing-extensions~=4.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (4.9.0)\r\n",
|
44 |
+
"Requirement already satisfied: uvicorn>=0.14.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (0.27.0.post1)\r\n",
|
45 |
+
"Requirement already satisfied: websockets<12.0,>=10.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio) (11.0.3)\r\n",
|
46 |
+
"Requirement already satisfied: fsspec in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from gradio-client==0.5.0->gradio) (2023.5.0)\r\n",
|
47 |
+
"Requirement already satisfied: jsonschema>=3.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from altair<6.0,>=4.2.0->gradio) (4.21.1)\r\n",
|
48 |
+
"Requirement already satisfied: toolz in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from altair<6.0,>=4.2.0->gradio) (0.12.1)\r\n",
|
49 |
+
"Requirement already satisfied: filelock in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from huggingface-hub>=0.14.0->gradio) (3.12.0)\r\n",
|
50 |
+
"Requirement already satisfied: tqdm>=4.42.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from huggingface-hub>=0.14.0->gradio) (4.65.0)\r\n",
|
51 |
+
"Requirement already satisfied: contourpy>=1.0.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib~=3.0->gradio) (1.2.0)\r\n",
|
52 |
+
"Requirement already satisfied: cycler>=0.10 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib~=3.0->gradio) (0.12.1)\r\n",
|
53 |
+
"Requirement already satisfied: fonttools>=4.22.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib~=3.0->gradio) (4.47.2)\r\n",
|
54 |
+
"Requirement already satisfied: kiwisolver>=1.3.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib~=3.0->gradio) (1.4.5)\r\n",
|
55 |
+
"Requirement already satisfied: pyparsing>=2.3.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib~=3.0->gradio) (3.1.1)\r\n",
|
56 |
+
"Requirement already satisfied: python-dateutil>=2.7 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from matplotlib~=3.0->gradio) (2.8.2)\r\n",
|
57 |
+
"Requirement already satisfied: pytz>=2020.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from pandas<3.0,>=1.0->gradio) (2023.3)\r\n",
|
58 |
+
"Requirement already satisfied: tzdata>=2022.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from pandas<3.0,>=1.0->gradio) (2023.3)\r\n",
|
59 |
+
"Requirement already satisfied: annotated-types>=0.4.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio) (0.6.0)\r\n",
|
60 |
+
"Requirement already satisfied: pydantic-core==2.16.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio) (2.16.1)\r\n",
|
61 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests~=2.0->gradio) (3.1.0)\r\n",
|
62 |
+
"Requirement already satisfied: idna<4,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests~=2.0->gradio) (3.4)\r\n",
|
63 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests~=2.0->gradio) (2.0.2)\r\n",
|
64 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests~=2.0->gradio) (2023.5.7)\r\n",
|
65 |
+
"Requirement already satisfied: click>=7.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from uvicorn>=0.14.0->gradio) (8.1.3)\r\n",
|
66 |
+
"Requirement already satisfied: h11>=0.8 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from uvicorn>=0.14.0->gradio) (0.14.0)\r\n",
|
67 |
+
"Requirement already satisfied: starlette<0.36.0,>=0.35.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from fastapi->gradio) (0.35.1)\r\n",
|
68 |
+
"Requirement already satisfied: anyio in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from httpx->gradio) (4.2.0)\r\n",
|
69 |
+
"Requirement already satisfied: httpcore==1.* in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from httpx->gradio) (1.0.2)\r\n",
|
70 |
+
"Requirement already satisfied: sniffio in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from httpx->gradio) (1.3.0)\r\n",
|
71 |
+
"Requirement already satisfied: attrs>=22.2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (23.2.0)\r\n",
|
72 |
+
"Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (2023.12.1)\r\n",
|
73 |
+
"Requirement already satisfied: referencing>=0.28.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (0.33.0)\r\n",
|
74 |
+
"Requirement already satisfied: rpds-py>=0.7.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (0.17.1)\r\n",
|
75 |
+
"Requirement already satisfied: six>=1.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib~=3.0->gradio) (1.16.0)\r\n"
|
76 |
+
]
|
77 |
+
}
|
78 |
+
],
|
79 |
+
"source": [
|
80 |
+
"!pip install -Uqq fastai\n",
|
81 |
+
"!pip install --upgrade pip\n",
|
82 |
+
"!pip install gradio"
|
83 |
+
]
|
84 |
+
},
|
85 |
+
{
|
86 |
+
"cell_type": "code",
|
87 |
+
"outputs": [],
|
88 |
+
"source": [
|
89 |
+
"#|default_exp app"
|
90 |
+
],
|
91 |
+
"metadata": {
|
92 |
+
"collapsed": false,
|
93 |
+
"ExecuteTime": {
|
94 |
+
"end_time": "2024-01-31T12:25:20.511978Z",
|
95 |
+
"start_time": "2024-01-31T12:25:20.509240Z"
|
96 |
+
}
|
97 |
+
},
|
98 |
+
"id": "131cfda07ddd85ac",
|
99 |
+
"execution_count": 22
|
100 |
+
},
|
101 |
+
{
|
102 |
+
"cell_type": "code",
|
103 |
+
"outputs": [],
|
104 |
+
"source": [
|
105 |
+
"#|export\n",
|
106 |
+
"from fastai.vision.all import *\n",
|
107 |
+
"import gradio as gr\n",
|
108 |
+
"\n",
|
109 |
+
"def is_grizzly(x): return x[0].isupper()"
|
110 |
+
],
|
111 |
+
"metadata": {
|
112 |
+
"collapsed": false,
|
113 |
+
"ExecuteTime": {
|
114 |
+
"end_time": "2024-01-31T12:25:20.515452Z",
|
115 |
+
"start_time": "2024-01-31T12:25:20.513410Z"
|
116 |
+
}
|
117 |
+
},
|
118 |
+
"id": "69aefb3580da341f",
|
119 |
+
"execution_count": 23
|
120 |
+
},
|
121 |
+
{
|
122 |
+
"cell_type": "code",
|
123 |
+
"outputs": [],
|
124 |
+
"source": [
|
125 |
+
"#|export\n",
|
126 |
+
"learn = load_learner('export.pkl')"
|
127 |
+
],
|
128 |
+
"metadata": {
|
129 |
+
"collapsed": false,
|
130 |
+
"ExecuteTime": {
|
131 |
+
"end_time": "2024-01-31T12:25:20.540837Z",
|
132 |
+
"start_time": "2024-01-31T12:25:20.516440Z"
|
133 |
+
}
|
134 |
+
},
|
135 |
+
"id": "65a607022a16cd59",
|
136 |
+
"execution_count": 24
|
137 |
+
},
|
138 |
+
{
|
139 |
+
"cell_type": "code",
|
140 |
+
"outputs": [],
|
141 |
+
"source": [
|
142 |
+
"#|export\n",
|
143 |
+
"categories = ('black', 'grizzly', 'teddy')\n",
|
144 |
+
"\n",
|
145 |
+
"def classify_image(img):\n",
|
146 |
+
" pred,pred_idx,probs = learn.predict(img)\n",
|
147 |
+
" return dict(zip(categories, map(float, probs)))"
|
148 |
+
],
|
149 |
+
"metadata": {
|
150 |
+
"collapsed": false,
|
151 |
+
"ExecuteTime": {
|
152 |
+
"end_time": "2024-01-31T12:25:20.545161Z",
|
153 |
+
"start_time": "2024-01-31T12:25:20.541167Z"
|
154 |
+
}
|
155 |
+
},
|
156 |
+
"id": "5d718a1ff473d36f",
|
157 |
+
"execution_count": 25
|
158 |
+
},
|
159 |
+
{
|
160 |
+
"cell_type": "code",
|
161 |
+
"outputs": [],
|
162 |
+
"source": [
|
163 |
+
"#|export\n",
|
164 |
+
"image = gr.Image(shape=(224, 224))\n",
|
165 |
+
"label = gr.Label()\n",
|
166 |
+
"examples = [\n",
|
167 |
+
" ['images/grizzly.png'],\n",
|
168 |
+
" ['images/black.png'],\n",
|
169 |
+
" ['images/teddy.png']\n",
|
170 |
+
"]"
|
171 |
+
],
|
172 |
+
"metadata": {
|
173 |
+
"collapsed": false,
|
174 |
+
"ExecuteTime": {
|
175 |
+
"end_time": "2024-01-31T12:25:20.548430Z",
|
176 |
+
"start_time": "2024-01-31T12:25:20.544100Z"
|
177 |
+
}
|
178 |
+
},
|
179 |
+
"id": "f3eb492b280e1353",
|
180 |
+
"execution_count": 26
|
181 |
+
},
|
182 |
+
{
|
183 |
+
"cell_type": "code",
|
184 |
+
"outputs": [
|
185 |
+
{
|
186 |
+
"name": "stdout",
|
187 |
+
"output_type": "stream",
|
188 |
+
"text": [
|
189 |
+
"Running on local URL: http://127.0.0.1:7861\n",
|
190 |
+
"\n",
|
191 |
+
"To create a public link, set `share=True` in `launch()`.\n"
|
192 |
+
]
|
193 |
+
},
|
194 |
+
{
|
195 |
+
"data": {
|
196 |
+
"text/plain": "<IPython.core.display.HTML object>",
|
197 |
+
"text/html": "<div><iframe src=\"http://127.0.0.1:7861/\" width=\"100%\" height=\"500\" allow=\"autoplay; camera; microphone; clipboard-read; clipboard-write;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
198 |
+
},
|
199 |
+
"metadata": {},
|
200 |
+
"output_type": "display_data"
|
201 |
+
},
|
202 |
+
{
|
203 |
+
"data": {
|
204 |
+
"text/plain": ""
|
205 |
+
},
|
206 |
+
"execution_count": 27,
|
207 |
+
"metadata": {},
|
208 |
+
"output_type": "execute_result"
|
209 |
+
}
|
210 |
+
],
|
211 |
+
"source": [
|
212 |
+
"#|export\n",
|
213 |
+
"gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples).launch()"
|
214 |
+
],
|
215 |
+
"metadata": {
|
216 |
+
"collapsed": false,
|
217 |
+
"ExecuteTime": {
|
218 |
+
"end_time": "2024-01-31T12:25:20.730168Z",
|
219 |
+
"start_time": "2024-01-31T12:25:20.549165Z"
|
220 |
+
}
|
221 |
+
},
|
222 |
+
"id": "2f43279622f0bad4",
|
223 |
+
"execution_count": 27
|
224 |
+
},
|
225 |
+
{
|
226 |
+
"cell_type": "code",
|
227 |
+
"outputs": [
|
228 |
+
{
|
229 |
+
"name": "stdout",
|
230 |
+
"output_type": "stream",
|
231 |
+
"text": [
|
232 |
+
"Requirement already satisfied: nbdev in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (2.3.13)\r\n",
|
233 |
+
"Requirement already satisfied: ipywidgets<=8.0.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbdev) (7.8.1)\r\n",
|
234 |
+
"Requirement already satisfied: fastcore>=1.5.27 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbdev) (1.5.29)\r\n",
|
235 |
+
"Requirement already satisfied: execnb>=0.1.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbdev) (0.1.5)\r\n",
|
236 |
+
"Requirement already satisfied: astunparse in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbdev) (1.6.3)\r\n",
|
237 |
+
"Requirement already satisfied: ghapi>=1.0.3 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbdev) (1.0.4)\r\n",
|
238 |
+
"Requirement already satisfied: watchdog in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbdev) (3.0.0)\r\n",
|
239 |
+
"Requirement already satisfied: asttokens in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbdev) (2.4.1)\r\n",
|
240 |
+
"Requirement already satisfied: PyYAML in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbdev) (6.0)\r\n",
|
241 |
+
"Requirement already satisfied: ipython in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from execnb>=0.1.4->nbdev) (8.21.0)\r\n",
|
242 |
+
"Requirement already satisfied: pip in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from fastcore>=1.5.27->nbdev) (23.3.2)\r\n",
|
243 |
+
"Requirement already satisfied: packaging in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from fastcore>=1.5.27->nbdev) (23.1)\r\n",
|
244 |
+
"Requirement already satisfied: comm>=0.1.3 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipywidgets<=8.0.4->nbdev) (0.2.1)\r\n",
|
245 |
+
"Requirement already satisfied: ipython-genutils~=0.2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipywidgets<=8.0.4->nbdev) (0.2.0)\r\n",
|
246 |
+
"Requirement already satisfied: traitlets>=4.3.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipywidgets<=8.0.4->nbdev) (5.14.1)\r\n",
|
247 |
+
"Requirement already satisfied: widgetsnbextension~=3.6.6 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipywidgets<=8.0.4->nbdev) (3.6.6)\r\n",
|
248 |
+
"Requirement already satisfied: jupyterlab-widgets<3,>=1.0.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipywidgets<=8.0.4->nbdev) (1.1.7)\r\n",
|
249 |
+
"Requirement already satisfied: six>=1.12.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from asttokens->nbdev) (1.16.0)\r\n",
|
250 |
+
"Requirement already satisfied: wheel<1.0,>=0.23.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from astunparse->nbdev) (0.40.0)\r\n",
|
251 |
+
"Requirement already satisfied: decorator in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipython->execnb>=0.1.4->nbdev) (5.1.1)\r\n",
|
252 |
+
"Requirement already satisfied: jedi>=0.16 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipython->execnb>=0.1.4->nbdev) (0.19.1)\r\n",
|
253 |
+
"Requirement already satisfied: matplotlib-inline in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipython->execnb>=0.1.4->nbdev) (0.1.6)\r\n",
|
254 |
+
"Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipython->execnb>=0.1.4->nbdev) (3.0.43)\r\n",
|
255 |
+
"Requirement already satisfied: pygments>=2.4.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipython->execnb>=0.1.4->nbdev) (2.17.2)\r\n",
|
256 |
+
"Requirement already satisfied: stack-data in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipython->execnb>=0.1.4->nbdev) (0.6.3)\r\n",
|
257 |
+
"Requirement already satisfied: pexpect>4.3 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipython->execnb>=0.1.4->nbdev) (4.9.0)\r\n",
|
258 |
+
"Requirement already satisfied: notebook>=4.4.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (7.0.7)\r\n",
|
259 |
+
"Requirement already satisfied: parso<0.9.0,>=0.8.3 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jedi>=0.16->ipython->execnb>=0.1.4->nbdev) (0.8.3)\r\n",
|
260 |
+
"Requirement already satisfied: jupyter-server<3,>=2.4.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.12.5)\r\n",
|
261 |
+
"Requirement already satisfied: jupyterlab-server<3,>=2.22.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.25.2)\r\n",
|
262 |
+
"Requirement already satisfied: jupyterlab<5,>=4.0.2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (4.0.12)\r\n",
|
263 |
+
"Requirement already satisfied: notebook-shim<0.3,>=0.2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.2.3)\r\n",
|
264 |
+
"Requirement already satisfied: tornado>=6.2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (6.4)\r\n",
|
265 |
+
"Requirement already satisfied: ptyprocess>=0.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from pexpect>4.3->ipython->execnb>=0.1.4->nbdev) (0.7.0)\r\n",
|
266 |
+
"Requirement already satisfied: wcwidth in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython->execnb>=0.1.4->nbdev) (0.2.13)\r\n",
|
267 |
+
"Requirement already satisfied: executing>=1.2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from stack-data->ipython->execnb>=0.1.4->nbdev) (2.0.1)\r\n",
|
268 |
+
"Requirement already satisfied: pure-eval in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from stack-data->ipython->execnb>=0.1.4->nbdev) (0.2.2)\r\n",
|
269 |
+
"Requirement already satisfied: anyio>=3.1.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (4.2.0)\r\n",
|
270 |
+
"Requirement already satisfied: argon2-cffi in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (23.1.0)\r\n",
|
271 |
+
"Requirement already satisfied: jinja2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (3.1.2)\r\n",
|
272 |
+
"Requirement already satisfied: jupyter-client>=7.4.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (8.6.0)\r\n",
|
273 |
+
"Requirement already satisfied: jupyter-core!=5.0.*,>=4.12 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (5.7.1)\r\n",
|
274 |
+
"Requirement already satisfied: jupyter-events>=0.9.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.9.0)\r\n",
|
275 |
+
"Requirement already satisfied: jupyter-server-terminals in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.5.2)\r\n",
|
276 |
+
"Requirement already satisfied: nbconvert>=6.4.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (7.14.2)\r\n",
|
277 |
+
"Requirement already satisfied: nbformat>=5.3.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (5.9.2)\r\n",
|
278 |
+
"Requirement already satisfied: overrides in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (7.7.0)\r\n",
|
279 |
+
"Requirement already satisfied: prometheus-client in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.19.0)\r\n",
|
280 |
+
"Requirement already satisfied: pyzmq>=24 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (25.1.2)\r\n",
|
281 |
+
"Requirement already satisfied: send2trash>=1.8.2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.8.2)\r\n",
|
282 |
+
"Requirement already satisfied: terminado>=0.8.3 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.18.0)\r\n",
|
283 |
+
"Requirement already satisfied: websocket-client in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.7.0)\r\n",
|
284 |
+
"Requirement already satisfied: async-lru>=1.0.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyterlab<5,>=4.0.2->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.0.4)\r\n",
|
285 |
+
"Requirement already satisfied: ipykernel in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyterlab<5,>=4.0.2->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (6.29.0)\r\n",
|
286 |
+
"Requirement already satisfied: jupyter-lsp>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyterlab<5,>=4.0.2->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.2.2)\r\n",
|
287 |
+
"Requirement already satisfied: babel>=2.10 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.14.0)\r\n",
|
288 |
+
"Requirement already satisfied: json5>=0.9.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.9.14)\r\n",
|
289 |
+
"Requirement already satisfied: jsonschema>=4.18.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (4.21.1)\r\n",
|
290 |
+
"Requirement already satisfied: requests>=2.31 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.31.0)\r\n",
|
291 |
+
"Requirement already satisfied: idna>=2.8 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (3.4)\r\n",
|
292 |
+
"Requirement already satisfied: sniffio>=1.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from anyio>=3.1.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.3.0)\r\n",
|
293 |
+
"Requirement already satisfied: MarkupSafe>=2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jinja2->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.1.2)\r\n",
|
294 |
+
"Requirement already satisfied: attrs>=22.2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (23.2.0)\r\n",
|
295 |
+
"Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2023.12.1)\r\n",
|
296 |
+
"Requirement already satisfied: referencing>=0.28.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.33.0)\r\n",
|
297 |
+
"Requirement already satisfied: rpds-py>=0.7.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema>=4.18.0->jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.17.1)\r\n",
|
298 |
+
"Requirement already satisfied: python-dateutil>=2.8.2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-client>=7.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.8.2)\r\n",
|
299 |
+
"Requirement already satisfied: platformdirs>=2.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-core!=5.0.*,>=4.12->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (4.2.0)\r\n",
|
300 |
+
"Requirement already satisfied: python-json-logger>=2.0.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.0.7)\r\n",
|
301 |
+
"Requirement already satisfied: rfc3339-validator in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.1.4)\r\n",
|
302 |
+
"Requirement already satisfied: rfc3986-validator>=0.1.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.1.1)\r\n",
|
303 |
+
"Requirement already satisfied: beautifulsoup4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (4.12.3)\r\n",
|
304 |
+
"Requirement already satisfied: bleach!=5.0.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (6.1.0)\r\n",
|
305 |
+
"Requirement already satisfied: defusedxml in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.7.1)\r\n",
|
306 |
+
"Requirement already satisfied: jupyterlab-pygments in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.3.0)\r\n",
|
307 |
+
"Requirement already satisfied: mistune<4,>=2.0.3 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (3.0.2)\r\n",
|
308 |
+
"Requirement already satisfied: nbclient>=0.5.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.9.0)\r\n",
|
309 |
+
"Requirement already satisfied: pandocfilters>=1.4.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.5.1)\r\n",
|
310 |
+
"Requirement already satisfied: tinycss2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.2.1)\r\n",
|
311 |
+
"Requirement already satisfied: fastjsonschema in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from nbformat>=5.3.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.19.1)\r\n",
|
312 |
+
"Requirement already satisfied: charset-normalizer<4,>=2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests>=2.31->jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (3.1.0)\r\n",
|
313 |
+
"Requirement already satisfied: urllib3<3,>=1.21.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests>=2.31->jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.0.2)\r\n",
|
314 |
+
"Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests>=2.31->jupyterlab-server<3,>=2.22.1->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2023.5.7)\r\n",
|
315 |
+
"Requirement already satisfied: argon2-cffi-bindings in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from argon2-cffi->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (21.2.0)\r\n",
|
316 |
+
"Requirement already satisfied: appnope in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipykernel->jupyterlab<5,>=4.0.2->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.1.3)\r\n",
|
317 |
+
"Requirement already satisfied: debugpy>=1.6.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipykernel->jupyterlab<5,>=4.0.2->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.8.0)\r\n",
|
318 |
+
"Requirement already satisfied: nest-asyncio in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipykernel->jupyterlab<5,>=4.0.2->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.6.0)\r\n",
|
319 |
+
"Requirement already satisfied: psutil in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from ipykernel->jupyterlab<5,>=4.0.2->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (5.9.5)\r\n",
|
320 |
+
"Requirement already satisfied: webencodings in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from bleach!=5.0.0->nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (0.5.1)\r\n",
|
321 |
+
"Requirement already satisfied: fqdn in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.5.1)\r\n",
|
322 |
+
"Requirement already satisfied: isoduration in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (20.11.0)\r\n",
|
323 |
+
"Requirement already satisfied: jsonpointer>1.13 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.4)\r\n",
|
324 |
+
"Requirement already satisfied: uri-template in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.3.0)\r\n",
|
325 |
+
"Requirement already satisfied: webcolors>=1.11 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.13)\r\n",
|
326 |
+
"Requirement already satisfied: cffi>=1.0.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.16.0)\r\n",
|
327 |
+
"Requirement already satisfied: soupsieve>1.2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from beautifulsoup4->nbconvert>=6.4.4->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.5)\r\n",
|
328 |
+
"Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.21)\r\n",
|
329 |
+
"Requirement already satisfied: arrow>=0.15.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (1.3.0)\r\n",
|
330 |
+
"Requirement already satisfied: types-python-dateutil>=2.8.10 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from arrow>=0.15.0->isoduration->jsonschema[format-nongpl]>=4.18.0->jupyter-events>=0.9.0->jupyter-server<3,>=2.4.0->notebook>=4.4.1->widgetsnbextension~=3.6.6->ipywidgets<=8.0.4->nbdev) (2.8.19.20240106)\r\n"
|
331 |
+
]
|
332 |
+
}
|
333 |
+
],
|
334 |
+
"source": [
|
335 |
+
"!pip install nbdev"
|
336 |
+
],
|
337 |
+
"metadata": {
|
338 |
+
"collapsed": false,
|
339 |
+
"ExecuteTime": {
|
340 |
+
"end_time": "2024-01-31T12:25:22.908163Z",
|
341 |
+
"start_time": "2024-01-31T12:25:20.730331Z"
|
342 |
+
}
|
343 |
+
},
|
344 |
+
"id": "876b397b80c82dd",
|
345 |
+
"execution_count": 28
|
346 |
+
},
|
347 |
+
{
|
348 |
+
"cell_type": "code",
|
349 |
+
"outputs": [],
|
350 |
+
"source": [
|
351 |
+
"import nbdev"
|
352 |
+
],
|
353 |
+
"metadata": {
|
354 |
+
"collapsed": false,
|
355 |
+
"ExecuteTime": {
|
356 |
+
"end_time": "2024-01-31T12:25:22.916459Z",
|
357 |
+
"start_time": "2024-01-31T12:25:22.908044Z"
|
358 |
+
}
|
359 |
+
},
|
360 |
+
"id": "a6999db4bdd9fc11",
|
361 |
+
"execution_count": 29
|
362 |
+
},
|
363 |
+
{
|
364 |
+
"cell_type": "code",
|
365 |
+
"outputs": [
|
366 |
+
{
|
367 |
+
"name": "stdout",
|
368 |
+
"output_type": "stream",
|
369 |
+
"text": [
|
370 |
+
"Export successful.\n"
|
371 |
+
]
|
372 |
+
}
|
373 |
+
],
|
374 |
+
"source": [
|
375 |
+
"nbdev.export.nb_export('app.ipynb', './')\n",
|
376 |
+
"print('Export successful.')"
|
377 |
+
],
|
378 |
+
"metadata": {
|
379 |
+
"collapsed": false,
|
380 |
+
"ExecuteTime": {
|
381 |
+
"end_time": "2024-01-31T12:25:22.923857Z",
|
382 |
+
"start_time": "2024-01-31T12:25:22.913165Z"
|
383 |
+
}
|
384 |
+
},
|
385 |
+
"id": "4b9a6222130c5222",
|
386 |
+
"execution_count": 30
|
387 |
+
},
|
388 |
+
{
|
389 |
+
"cell_type": "code",
|
390 |
+
"outputs": [],
|
391 |
+
"source": [],
|
392 |
+
"metadata": {
|
393 |
+
"collapsed": false,
|
394 |
+
"ExecuteTime": {
|
395 |
+
"end_time": "2024-01-31T12:25:22.924345Z",
|
396 |
+
"start_time": "2024-01-31T12:25:22.918277Z"
|
397 |
+
}
|
398 |
+
},
|
399 |
+
"id": "a163ce5fbeb88c1f",
|
400 |
+
"execution_count": 30
|
401 |
+
}
|
402 |
+
],
|
403 |
+
"metadata": {
|
404 |
+
"kernelspec": {
|
405 |
+
"display_name": "Python 3",
|
406 |
+
"language": "python",
|
407 |
+
"name": "python3"
|
408 |
+
},
|
409 |
+
"language_info": {
|
410 |
+
"codemirror_mode": {
|
411 |
+
"name": "ipython",
|
412 |
+
"version": 2
|
413 |
+
},
|
414 |
+
"file_extension": ".py",
|
415 |
+
"mimetype": "text/x-python",
|
416 |
+
"name": "python",
|
417 |
+
"nbconvert_exporter": "python",
|
418 |
+
"pygments_lexer": "ipython2",
|
419 |
+
"version": "2.7.6"
|
420 |
+
}
|
421 |
+
},
|
422 |
+
"nbformat": 4,
|
423 |
+
"nbformat_minor": 5
|
424 |
+
}
|
app.py
CHANGED
@@ -1,7 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
2 |
+
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'is_grizzly', 'classify_image']
|
5 |
+
|
6 |
+
# %% app.ipynb 2
|
7 |
+
from fastai.vision.all import *
|
8 |
import gradio as gr
|
9 |
|
10 |
+
def is_grizzly(x): return x[0].isupper()
|
11 |
+
|
12 |
+
# %% app.ipynb 3
|
13 |
+
learn = load_learner('export.pkl')
|
14 |
+
|
15 |
+
# %% app.ipynb 4
|
16 |
+
categories = ('black', 'grizzly', 'teddy')
|
17 |
+
|
18 |
+
def classify_image(img):
|
19 |
+
pred,pred_idx,probs = learn.predict(img)
|
20 |
+
return dict(zip(categories, map(float, probs)))
|
21 |
+
|
22 |
+
# %% app.ipynb 5
|
23 |
+
image = gr.Image(shape=(224, 224))
|
24 |
+
label = gr.Label()
|
25 |
+
examples = [
|
26 |
+
['images/grizzly.png'],
|
27 |
+
['images/black.png'],
|
28 |
+
['images/teddy.png']
|
29 |
+
]
|
30 |
|
31 |
+
# %% app.ipynb 6
|
32 |
+
gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples).launch()
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d24010373fc393f50fd312076063f94d996c40e51aa897dbeee75053dc9de2be
|
3 |
+
size 46969598
|
images/black.png
ADDED
Git LFS Details
|
images/grizzly.png
ADDED
Git LFS Details
|
images/teddy.png
ADDED
Git LFS Details
|