Spaces:
Sleeping
Sleeping
Adding all files
Browse files
A.jpg
ADDED
![]() |
App.ipynb
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "code",
|
5 |
+
"execution_count": 1,
|
6 |
+
"id": "cff2e3b3-d3fb-4932-b8f3-a3fc6dc2b151",
|
7 |
+
"metadata": {},
|
8 |
+
"outputs": [
|
9 |
+
{
|
10 |
+
"name": "stderr",
|
11 |
+
"output_type": "stream",
|
12 |
+
"text": [
|
13 |
+
"/Users/affan/Library/Python/3.9/lib/python/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
14 |
+
" from .autonotebook import tqdm as notebook_tqdm\n",
|
15 |
+
"/var/folders/l3/j0h5_0155713kvrktqyvrrxc0000gn/T/ipykernel_1254/2190181889.py:12: GradioDeprecationWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
|
16 |
+
" img=gr.inputs.Image(shape=(28,28),source=\"canvas\",invert_colors=True)\n",
|
17 |
+
"/var/folders/l3/j0h5_0155713kvrktqyvrrxc0000gn/T/ipykernel_1254/2190181889.py:12: GradioDeprecationWarning: `optional` parameter is deprecated, and it has no effect\n",
|
18 |
+
" img=gr.inputs.Image(shape=(28,28),source=\"canvas\",invert_colors=True)\n",
|
19 |
+
"/var/folders/l3/j0h5_0155713kvrktqyvrrxc0000gn/T/ipykernel_1254/2190181889.py:13: GradioDeprecationWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
|
20 |
+
" label=gr.outputs.Label()\n",
|
21 |
+
"/var/folders/l3/j0h5_0155713kvrktqyvrrxc0000gn/T/ipykernel_1254/2190181889.py:13: GradioUnusedKwargWarning: You have unused kwarg parameters in Label, please remove them: {'type': 'auto'}\n",
|
22 |
+
" label=gr.outputs.Label()\n"
|
23 |
+
]
|
24 |
+
},
|
25 |
+
{
|
26 |
+
"name": "stdout",
|
27 |
+
"output_type": "stream",
|
28 |
+
"text": [
|
29 |
+
"Running on local URL: http://127.0.0.1:7860\n",
|
30 |
+
"\n",
|
31 |
+
"To create a public link, set `share=True` in `launch()`.\n"
|
32 |
+
]
|
33 |
+
},
|
34 |
+
{
|
35 |
+
"data": {
|
36 |
+
"text/plain": []
|
37 |
+
},
|
38 |
+
"execution_count": 1,
|
39 |
+
"metadata": {},
|
40 |
+
"output_type": "execute_result"
|
41 |
+
},
|
42 |
+
{
|
43 |
+
"data": {
|
44 |
+
"text/html": [
|
45 |
+
"\n",
|
46 |
+
"<style>\n",
|
47 |
+
" /* Turns off some styling */\n",
|
48 |
+
" progress {\n",
|
49 |
+
" /* gets rid of default border in Firefox and Opera. */\n",
|
50 |
+
" border: none;\n",
|
51 |
+
" /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
|
52 |
+
" background-size: auto;\n",
|
53 |
+
" }\n",
|
54 |
+
" progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
|
55 |
+
" background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
|
56 |
+
" }\n",
|
57 |
+
" .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
|
58 |
+
" background: #F44336;\n",
|
59 |
+
" }\n",
|
60 |
+
"</style>\n"
|
61 |
+
],
|
62 |
+
"text/plain": [
|
63 |
+
"<IPython.core.display.HTML object>"
|
64 |
+
]
|
65 |
+
},
|
66 |
+
"metadata": {},
|
67 |
+
"output_type": "display_data"
|
68 |
+
},
|
69 |
+
{
|
70 |
+
"data": {
|
71 |
+
"text/html": [],
|
72 |
+
"text/plain": [
|
73 |
+
"<IPython.core.display.HTML object>"
|
74 |
+
]
|
75 |
+
},
|
76 |
+
"metadata": {},
|
77 |
+
"output_type": "display_data"
|
78 |
+
}
|
79 |
+
],
|
80 |
+
"source": [
|
81 |
+
"import gradio as gr\n",
|
82 |
+
"from fastai.vision.all import *\n",
|
83 |
+
"learn=load_learner(\"model.pkl\")\n",
|
84 |
+
"\n",
|
85 |
+
"def classify_images(im):\n",
|
86 |
+
" pred,idx,probs=learn.predict(im)\n",
|
87 |
+
" s='Your submitted alphabet is '+pred\n",
|
88 |
+
" return s\n",
|
89 |
+
"\n",
|
90 |
+
"\n",
|
91 |
+
"\n",
|
92 |
+
"img=gr.inputs.Image(shape=(28,28),source=\"canvas\",invert_colors=True)\n",
|
93 |
+
"label=gr.outputs.Label()\n",
|
94 |
+
"examples=[\"A.jpg\",\"h.jpg\",\"z.jpg\"]\n",
|
95 |
+
"\n",
|
96 |
+
"intf=gr.Interface(title=\"English Alphabets Recognition App\",description=\"You can choose an example or draw in canvas. Press submit and model will recognize your input. This model only works on Capital Alphabets\",fn=classify_images,inputs=img,outputs=label,examples=examples)\n",
|
97 |
+
"intf.launch(inline=False)"
|
98 |
+
]
|
99 |
+
},
|
100 |
+
{
|
101 |
+
"cell_type": "code",
|
102 |
+
"execution_count": null,
|
103 |
+
"id": "9837ff83-7ce6-454c-8998-96d5b4e8b142",
|
104 |
+
"metadata": {},
|
105 |
+
"outputs": [],
|
106 |
+
"source": []
|
107 |
+
}
|
108 |
+
],
|
109 |
+
"metadata": {
|
110 |
+
"kernelspec": {
|
111 |
+
"display_name": "Python 3 (ipykernel)",
|
112 |
+
"language": "python",
|
113 |
+
"name": "python3"
|
114 |
+
},
|
115 |
+
"language_info": {
|
116 |
+
"codemirror_mode": {
|
117 |
+
"name": "ipython",
|
118 |
+
"version": 3
|
119 |
+
},
|
120 |
+
"file_extension": ".py",
|
121 |
+
"mimetype": "text/x-python",
|
122 |
+
"name": "python",
|
123 |
+
"nbconvert_exporter": "python",
|
124 |
+
"pygments_lexer": "ipython3",
|
125 |
+
"version": "3.9.6"
|
126 |
+
}
|
127 |
+
},
|
128 |
+
"nbformat": 4,
|
129 |
+
"nbformat_minor": 5
|
130 |
+
}
|
h.jpg
ADDED
![]() |
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5e1ebe15696ecfebd08a1c43412a968736cd8107d3159dea7f92f47e2006c514
|
3 |
+
size 55997721
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fastai
|
z.jpg
ADDED
![]() |