Spaces:
Sleeping
Sleeping
Peter Kibuchi
commited on
Commit
•
caf9f8a
1
Parent(s):
0101e37
Update Application
Browse files
app.ipynb
CHANGED
@@ -47,28 +47,14 @@
|
|
47 |
},
|
48 |
{
|
49 |
"cell_type": "code",
|
50 |
-
"execution_count":
|
51 |
"metadata": {},
|
52 |
"outputs": [
|
53 |
-
{
|
54 |
-
"name": "stderr",
|
55 |
-
"output_type": "stream",
|
56 |
-
"text": [
|
57 |
-
"/home/kibuchi/mambaforge/lib/python3.10/site-packages/gradio/inputs.py:257: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
|
58 |
-
" warnings.warn(\n",
|
59 |
-
"/home/kibuchi/mambaforge/lib/python3.10/site-packages/gradio/deprecation.py:40: UserWarning: `optional` parameter is deprecated, and it has no effect\n",
|
60 |
-
" warnings.warn(value)\n",
|
61 |
-
"/home/kibuchi/mambaforge/lib/python3.10/site-packages/gradio/outputs.py:197: UserWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
|
62 |
-
" warnings.warn(\n",
|
63 |
-
"/home/kibuchi/mambaforge/lib/python3.10/site-packages/gradio/deprecation.py:40: UserWarning: The 'type' parameter has been deprecated. Use the Number component instead.\n",
|
64 |
-
" warnings.warn(value)\n"
|
65 |
-
]
|
66 |
-
},
|
67 |
{
|
68 |
"name": "stdout",
|
69 |
"output_type": "stream",
|
70 |
"text": [
|
71 |
-
"Running on local URL: http://127.0.0.1:
|
72 |
"\n",
|
73 |
"To create a public link, set `share=True` in `launch()`.\n"
|
74 |
]
|
@@ -77,16 +63,57 @@
|
|
77 |
"data": {
|
78 |
"text/plain": []
|
79 |
},
|
80 |
-
"execution_count":
|
81 |
"metadata": {},
|
82 |
"output_type": "execute_result"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
}
|
84 |
],
|
85 |
"source": [
|
86 |
"#|export\n",
|
87 |
-
"
|
88 |
-
"
|
89 |
-
"
|
|
|
|
|
|
|
|
|
90 |
"\n",
|
91 |
"intf = gr.Interface(\n",
|
92 |
" fn=classify_img,\n",
|
@@ -101,7 +128,7 @@
|
|
101 |
},
|
102 |
{
|
103 |
"cell_type": "code",
|
104 |
-
"execution_count":
|
105 |
"metadata": {},
|
106 |
"outputs": [],
|
107 |
"source": [
|
@@ -110,7 +137,7 @@
|
|
110 |
},
|
111 |
{
|
112 |
"cell_type": "code",
|
113 |
-
"execution_count":
|
114 |
"metadata": {},
|
115 |
"outputs": [
|
116 |
{
|
|
|
47 |
},
|
48 |
{
|
49 |
"cell_type": "code",
|
50 |
+
"execution_count": 5,
|
51 |
"metadata": {},
|
52 |
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
{
|
54 |
"name": "stdout",
|
55 |
"output_type": "stream",
|
56 |
"text": [
|
57 |
+
"Running on local URL: http://127.0.0.1:7860\n",
|
58 |
"\n",
|
59 |
"To create a public link, set `share=True` in `launch()`.\n"
|
60 |
]
|
|
|
63 |
"data": {
|
64 |
"text/plain": []
|
65 |
},
|
66 |
+
"execution_count": 5,
|
67 |
"metadata": {},
|
68 |
"output_type": "execute_result"
|
69 |
+
},
|
70 |
+
{
|
71 |
+
"data": {
|
72 |
+
"text/html": [
|
73 |
+
"\n",
|
74 |
+
"<style>\n",
|
75 |
+
" /* Turns off some styling */\n",
|
76 |
+
" progress {\n",
|
77 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
78 |
+
" border: none;\n",
|
79 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
80 |
+
" background-size: auto;\n",
|
81 |
+
" }\n",
|
82 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
83 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
84 |
+
" }\n",
|
85 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
86 |
+
" background: #F44336;\n",
|
87 |
+
" }\n",
|
88 |
+
"</style>\n"
|
89 |
+
],
|
90 |
+
"text/plain": [
|
91 |
+
"<IPython.core.display.HTML object>"
|
92 |
+
]
|
93 |
+
},
|
94 |
+
"metadata": {},
|
95 |
+
"output_type": "display_data"
|
96 |
+
},
|
97 |
+
{
|
98 |
+
"data": {
|
99 |
+
"text/html": [],
|
100 |
+
"text/plain": [
|
101 |
+
"<IPython.core.display.HTML object>"
|
102 |
+
]
|
103 |
+
},
|
104 |
+
"metadata": {},
|
105 |
+
"output_type": "display_data"
|
106 |
}
|
107 |
],
|
108 |
"source": [
|
109 |
"#|export\n",
|
110 |
+
"from pathlib import Path\n",
|
111 |
+
"\n",
|
112 |
+
"image = gr.Image(shape=(192, 192))\n",
|
113 |
+
"label = gr.Label()\n",
|
114 |
+
"\n",
|
115 |
+
"path = Path(\"examples\")\n",
|
116 |
+
"examples = [file for file in path.iterdir()]\n",
|
117 |
"\n",
|
118 |
"intf = gr.Interface(\n",
|
119 |
" fn=classify_img,\n",
|
|
|
128 |
},
|
129 |
{
|
130 |
"cell_type": "code",
|
131 |
+
"execution_count": 6,
|
132 |
"metadata": {},
|
133 |
"outputs": [],
|
134 |
"source": [
|
|
|
137 |
},
|
138 |
{
|
139 |
"cell_type": "code",
|
140 |
+
"execution_count": 7,
|
141 |
"metadata": {},
|
142 |
"outputs": [
|
143 |
{
|
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
-
__all__ = ['learn', 'categories', 'image', 'label', 'examples', 'intf', 'classify_img']
|
5 |
|
6 |
# %% ../app.ipynb 1
|
7 |
from fastai.vision.all import *
|
@@ -19,9 +19,13 @@ def classify_img(img):
|
|
19 |
return dict(zip(categories, map(float, probs)))
|
20 |
|
21 |
# %% ../app.ipynb 4
|
|
|
|
|
22 |
image = gr.inputs.Image(shape=(192, 192))
|
23 |
label = gr.outputs.Label()
|
24 |
-
|
|
|
|
|
25 |
|
26 |
intf = gr.Interface(
|
27 |
fn=classify_img,
|
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: ../app.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
+
__all__ = ['learn', 'categories', 'image', 'label', 'path', 'examples', 'intf', 'classify_img']
|
5 |
|
6 |
# %% ../app.ipynb 1
|
7 |
from fastai.vision.all import *
|
|
|
19 |
return dict(zip(categories, map(float, probs)))
|
20 |
|
21 |
# %% ../app.ipynb 4
|
22 |
+
from pathlib import Path
|
23 |
+
|
24 |
image = gr.inputs.Image(shape=(192, 192))
|
25 |
label = gr.outputs.Label()
|
26 |
+
|
27 |
+
path = Path("examples")
|
28 |
+
examples = [file for file in path.iterdir()]
|
29 |
|
30 |
intf = gr.Interface(
|
31 |
fn=classify_img,
|