Spaces:
Runtime error
Runtime error
Benjamin Coman
commited on
Commit
•
d60cd51
1
Parent(s):
8943dde
not sure
Browse files- applocal.ipynb +138 -0
- cats-v-dogs-saving-a-basic-fastai-model.log +4 -28
- model.pkl +1 -1
- requirements.txt +1 -1
applocal.ipynb
ADDED
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
+
"id": "1587b6c6",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [
|
9 |
+
{
|
10 |
+
"name": "stdout",
|
11 |
+
"output_type": "stream",
|
12 |
+
"text": [
|
13 |
+
"Running on local URL: http://127.0.0.1:7862/\n",
|
14 |
+
"\n",
|
15 |
+
"To create a public link, set `share=True` in `launch()`.\n"
|
16 |
+
]
|
17 |
+
},
|
18 |
+
{
|
19 |
+
"data": {
|
20 |
+
"text/plain": [
|
21 |
+
"(<fastapi.applications.FastAPI at 0x7fd10795b970>,\n",
|
22 |
+
" 'http://127.0.0.1:7862/',\n",
|
23 |
+
" None)"
|
24 |
+
]
|
25 |
+
},
|
26 |
+
"execution_count": 1,
|
27 |
+
"metadata": {},
|
28 |
+
"output_type": "execute_result"
|
29 |
+
},
|
30 |
+
{
|
31 |
+
"data": {
|
32 |
+
"text/html": [
|
33 |
+
"\n",
|
34 |
+
"<style>\n",
|
35 |
+
" /* Turns off some styling */\n",
|
36 |
+
" progress {\n",
|
37 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
38 |
+
" border: none;\n",
|
39 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
40 |
+
" background-size: auto;\n",
|
41 |
+
" }\n",
|
42 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
43 |
+
" background: #F44336;\n",
|
44 |
+
" }\n",
|
45 |
+
"</style>\n"
|
46 |
+
],
|
47 |
+
"text/plain": [
|
48 |
+
"<IPython.core.display.HTML object>"
|
49 |
+
]
|
50 |
+
},
|
51 |
+
"metadata": {},
|
52 |
+
"output_type": "display_data"
|
53 |
+
},
|
54 |
+
{
|
55 |
+
"data": {
|
56 |
+
"text/html": [],
|
57 |
+
"text/plain": [
|
58 |
+
"<IPython.core.display.HTML object>"
|
59 |
+
]
|
60 |
+
},
|
61 |
+
"metadata": {},
|
62 |
+
"output_type": "display_data"
|
63 |
+
}
|
64 |
+
],
|
65 |
+
"source": [
|
66 |
+
"from fastai.vision.all import *\n",
|
67 |
+
"import gradio as gr\n",
|
68 |
+
"\n",
|
69 |
+
"def is_cat(x): return x[0].isupper()\n",
|
70 |
+
"\n",
|
71 |
+
"learn = load_learner('model.pkl')\n",
|
72 |
+
"\n",
|
73 |
+
"categories = ('Dog', 'Cat')\n",
|
74 |
+
"\n",
|
75 |
+
"def classify_image(img):\n",
|
76 |
+
" pred,idx,probs = learn.predict(img)\n",
|
77 |
+
" return( dict(zip(categories, map(float,probs))))\n",
|
78 |
+
"\n",
|
79 |
+
"image = gr.inputs.Image(shape=(192,192))\n",
|
80 |
+
"label = gr.outputs.Label()\n",
|
81 |
+
"examples = [ 'dog.jpg', 'cat.jpg' ]\n",
|
82 |
+
"\n",
|
83 |
+
"iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)\n",
|
84 |
+
"iface.launch(inline=False)\n"
|
85 |
+
]
|
86 |
+
},
|
87 |
+
{
|
88 |
+
"cell_type": "code",
|
89 |
+
"execution_count": null,
|
90 |
+
"id": "372eca61",
|
91 |
+
"metadata": {},
|
92 |
+
"outputs": [],
|
93 |
+
"source": []
|
94 |
+
},
|
95 |
+
{
|
96 |
+
"cell_type": "code",
|
97 |
+
"execution_count": null,
|
98 |
+
"id": "066f65b3",
|
99 |
+
"metadata": {},
|
100 |
+
"outputs": [],
|
101 |
+
"source": []
|
102 |
+
}
|
103 |
+
],
|
104 |
+
"metadata": {
|
105 |
+
"kernelspec": {
|
106 |
+
"display_name": "Python [conda env:root] *",
|
107 |
+
"language": "python",
|
108 |
+
"name": "conda-root-py"
|
109 |
+
},
|
110 |
+
"language_info": {
|
111 |
+
"codemirror_mode": {
|
112 |
+
"name": "ipython",
|
113 |
+
"version": 3
|
114 |
+
},
|
115 |
+
"file_extension": ".py",
|
116 |
+
"mimetype": "text/x-python",
|
117 |
+
"name": "python",
|
118 |
+
"nbconvert_exporter": "python",
|
119 |
+
"pygments_lexer": "ipython3",
|
120 |
+
"version": "3.9.10"
|
121 |
+
},
|
122 |
+
"toc": {
|
123 |
+
"base_numbering": 1,
|
124 |
+
"nav_menu": {},
|
125 |
+
"number_sections": true,
|
126 |
+
"sideBar": true,
|
127 |
+
"skip_h1_title": false,
|
128 |
+
"title_cell": "Table of Contents",
|
129 |
+
"title_sidebar": "Contents",
|
130 |
+
"toc_cell": false,
|
131 |
+
"toc_position": {},
|
132 |
+
"toc_section_display": true,
|
133 |
+
"toc_window_display": false
|
134 |
+
}
|
135 |
+
},
|
136 |
+
"nbformat": 4,
|
137 |
+
"nbformat_minor": 5
|
138 |
+
}
|
cats-v-dogs-saving-a-basic-fastai-model.log
CHANGED
@@ -1,29 +1,5 @@
|
|
1 |
-
[{"stream_name":"
|
2 |
-
,{"stream_name":"
|
3 |
-
,{"stream_name":"
|
4 |
-
,{"stream_name":"
|
5 |
-
,{"stream_name":"stdout","time":31.202366373,"data":"tensorflow 2.6.3 requires six~=1.15.0, but you have six 1.16.0 which is incompatible.\r\n"}
|
6 |
-
,{"stream_name":"stdout","time":31.202371611,"data":"tensorflow 2.6.3 requires wrapt~=1.12.1, but you have wrapt 1.14.0 which is incompatible.\r\n"}
|
7 |
-
,{"stream_name":"stdout","time":31.202376538,"data":"tensorflow-transform 1.7.0 requires pyarrow\u003c6,\u003e=1, but you have pyarrow 7.0.0 which is incompatible.\r\n"}
|
8 |
-
,{"stream_name":"stdout","time":31.202381524,"data":"tensorflow-transform 1.7.0 requires tensorflow!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,\u003c2.9,\u003e=1.15.5, but you have tensorflow 2.6.3 which is incompatible.\r\n"}
|
9 |
-
,{"stream_name":"stdout","time":31.202387134,"data":"tensorflow-serving-api 2.8.0 requires tensorflow\u003c3,\u003e=2.8.0, but you have tensorflow 2.6.3 which is incompatible.\r\n"}
|
10 |
-
,{"stream_name":"stdout","time":31.202392004,"data":"rich 12.2.0 requires typing-extensions\u003c5.0,\u003e=4.0.0; python_version \u003c \"3.9\", but you have typing-extensions 3.10.0.2 which is incompatible.\r\n"}
|
11 |
-
,{"stream_name":"stdout","time":31.202396609,"data":"pytorch-lightning 1.6.1 requires typing-extensions\u003e=4.0.0, but you have typing-extensions 3.10.0.2 which is incompatible.\r\n"}
|
12 |
-
,{"stream_name":"stdout","time":31.202401456,"data":"pytools 2022.1.5 requires typing-extensions\u003e=4.0; python_version \u003c \"3.11\", but you have typing-extensions 3.10.0.2 which is incompatible.\r\n"}
|
13 |
-
,{"stream_name":"stdout","time":31.202406488,"data":"flake8 4.0.1 requires importlib-metadata\u003c4.3; python_version \u003c \"3.8\", but you have importlib-metadata 4.11.3 which is incompatible.\r\n"}
|
14 |
-
,{"stream_name":"stdout","time":31.202411383,"data":"apache-beam 2.37.0 requires dill\u003c0.3.2,\u003e=0.3.1.1, but you have dill 0.3.4 which is incompatible.\r\n"}
|
15 |
-
,{"stream_name":"stdout","time":31.202416481,"data":"apache-beam 2.37.0 requires httplib2\u003c0.20.0,\u003e=0.8, but you have httplib2 0.20.4 which is incompatible.\r\n"}
|
16 |
-
,{"stream_name":"stdout","time":31.202421516,"data":"apache-beam 2.37.0 requires pyarrow\u003c7.0.0,\u003e=0.15.1, but you have pyarrow 7.0.0 which is incompatible.\r\n"}
|
17 |
-
,{"stream_name":"stdout","time":31.202426391,"data":"aioitertools 0.10.0 requires typing_extensions\u003e=4.0; python_version \u003c \"3.10\", but you have typing-extensions 3.10.0.2 which is incompatible.\r\n"}
|
18 |
-
,{"stream_name":"stdout","time":31.202432484,"data":"aiobotocore 2.2.0 requires botocore\u003c1.24.22,\u003e=1.24.21, but you have botocore 1.25.0 which is incompatible.\u001b[0m\u001b[31m\r\n"}
|
19 |
-
,{"stream_name":"stdout","time":31.623982283,"data":"\u001b[0m2.6.3\n"}
|
20 |
-
,{"stream_name":"stderr","time":67.417386845,"data":"Downloading: \"https://download.pytorch.org/models/resnet18-f37072fd.pth\" to /root/.cache/torch/hub/checkpoints/resnet18-f37072fd.pth\n"}
|
21 |
-
,{"stream_name":"stderr","time":275.897455627,"data":"/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py:2567: FutureWarning: --Exporter.preprocessors=[\"remove_papermill_header.RemovePapermillHeader\"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.\n"}
|
22 |
-
,{"stream_name":"stderr","time":275.897549503,"data":" FutureWarning,\n"}
|
23 |
-
,{"stream_name":"stderr","time":275.897568421,"data":"[NbConvertApp] Converting notebook __notebook__.ipynb to notebook\n"}
|
24 |
-
,{"stream_name":"stderr","time":276.070109353,"data":"[NbConvertApp] Writing 28661 bytes to __notebook__.ipynb\n"}
|
25 |
-
,{"stream_name":"stderr","time":277.718657501,"data":"/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py:2567: FutureWarning: --Exporter.preprocessors=[\"nbconvert.preprocessors.ExtractOutputPreprocessor\"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.\n"}
|
26 |
-
,{"stream_name":"stderr","time":277.718739244,"data":" FutureWarning,\n"}
|
27 |
-
,{"stream_name":"stderr","time":277.718947668,"data":"[NbConvertApp] Converting notebook __notebook__.ipynb to html\n"}
|
28 |
-
,{"stream_name":"stderr","time":278.271110209,"data":"[NbConvertApp] Writing 296408 bytes to __results__.html\n"}
|
29 |
]
|
|
|
1 |
+
[{"stream_name":"stderr","time":3.9026413939999998,"data":"/opt/conda/lib/python3.7/site-packages/traitlets/traitlets.py:2567: FutureWarning: --Exporter.preprocessors=[\"nbconvert.preprocessors.ExtractOutputPreprocessor\"] for containers is deprecated in traitlets 5.0. You can pass `--Exporter.preprocessors item` ... multiple times to add items to a list.\n"}
|
2 |
+
,{"stream_name":"stderr","time":3.902695877,"data":" FutureWarning,\n"}
|
3 |
+
,{"stream_name":"stderr","time":3.902701147,"data":"[NbConvertApp] Converting notebook __notebook__.ipynb to html\n"}
|
4 |
+
,{"stream_name":"stderr","time":4.948346808,"data":"[NbConvertApp] Writing 280460 bytes to __results__.html\n"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
]
|
model.pkl
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 47059947
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:be5614d76b7f4f275264be7f5bfc74426db3737bf951e1af1b25c0a1251507fb
|
3 |
size 47059947
|
requirements.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
fastai
|
|
|
1 |
+
fastai
|