Mr00Magician
commited on
Commit
•
6e25d46
1
Parent(s):
b57bed9
updated app.py
Browse files- Training_CNN.ipynb +25 -8
- app.py +1 -1
Training_CNN.ipynb
CHANGED
@@ -2,17 +2,19 @@
|
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
-
"execution_count":
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
9 |
"import tensorflow as tf\n",
|
10 |
-
"import numpy as np"
|
|
|
|
|
11 |
]
|
12 |
},
|
13 |
{
|
14 |
"cell_type": "code",
|
15 |
-
"execution_count":
|
16 |
"metadata": {},
|
17 |
"outputs": [],
|
18 |
"source": [
|
@@ -21,7 +23,7 @@
|
|
21 |
},
|
22 |
{
|
23 |
"cell_type": "code",
|
24 |
-
"execution_count":
|
25 |
"metadata": {},
|
26 |
"outputs": [
|
27 |
{
|
@@ -30,7 +32,7 @@
|
|
30 |
"(60000, 28, 28)"
|
31 |
]
|
32 |
},
|
33 |
-
"execution_count":
|
34 |
"metadata": {},
|
35 |
"output_type": "execute_result"
|
36 |
}
|
@@ -39,6 +41,21 @@
|
|
39 |
"xtrain.shape"
|
40 |
]
|
41 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
{
|
43 |
"cell_type": "code",
|
44 |
"execution_count": 4,
|
@@ -648,7 +665,7 @@
|
|
648 |
],
|
649 |
"metadata": {
|
650 |
"kernelspec": {
|
651 |
-
"display_name": "
|
652 |
"language": "python",
|
653 |
"name": "python3"
|
654 |
},
|
@@ -662,12 +679,12 @@
|
|
662 |
"name": "python",
|
663 |
"nbconvert_exporter": "python",
|
664 |
"pygments_lexer": "ipython3",
|
665 |
-
"version": "3.9.12"
|
666 |
},
|
667 |
"orig_nbformat": 4,
|
668 |
"vscode": {
|
669 |
"interpreter": {
|
670 |
-
"hash": "
|
671 |
}
|
672 |
}
|
673 |
},
|
2 |
"cells": [
|
3 |
{
|
4 |
"cell_type": "code",
|
5 |
+
"execution_count": 5,
|
6 |
"metadata": {},
|
7 |
"outputs": [],
|
8 |
"source": [
|
9 |
"import tensorflow as tf\n",
|
10 |
+
"import numpy as np\n",
|
11 |
+
"import cv2\n",
|
12 |
+
"from PIL import Image"
|
13 |
]
|
14 |
},
|
15 |
{
|
16 |
"cell_type": "code",
|
17 |
+
"execution_count": 6,
|
18 |
"metadata": {},
|
19 |
"outputs": [],
|
20 |
"source": [
|
23 |
},
|
24 |
{
|
25 |
"cell_type": "code",
|
26 |
+
"execution_count": 7,
|
27 |
"metadata": {},
|
28 |
"outputs": [
|
29 |
{
|
32 |
"(60000, 28, 28)"
|
33 |
]
|
34 |
},
|
35 |
+
"execution_count": 7,
|
36 |
"metadata": {},
|
37 |
"output_type": "execute_result"
|
38 |
}
|
41 |
"xtrain.shape"
|
42 |
]
|
43 |
},
|
44 |
+
{
|
45 |
+
"cell_type": "code",
|
46 |
+
"execution_count": 8,
|
47 |
+
"metadata": {},
|
48 |
+
"outputs": [],
|
49 |
+
"source": [
|
50 |
+
"win = cv2.namedWindow('default')\n",
|
51 |
+
"img = cv2.imread('test_img.jpeg')\n",
|
52 |
+
"img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n",
|
53 |
+
"cv2.imshow('default', xtrain[0])\n",
|
54 |
+
"\n",
|
55 |
+
"cv2.waitKey(0)\n",
|
56 |
+
"cv2.destroyAllWindows()"
|
57 |
+
]
|
58 |
+
},
|
59 |
{
|
60 |
"cell_type": "code",
|
61 |
"execution_count": 4,
|
665 |
],
|
666 |
"metadata": {
|
667 |
"kernelspec": {
|
668 |
+
"display_name": "develop_env",
|
669 |
"language": "python",
|
670 |
"name": "python3"
|
671 |
},
|
679 |
"name": "python",
|
680 |
"nbconvert_exporter": "python",
|
681 |
"pygments_lexer": "ipython3",
|
682 |
+
"version": "3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)]"
|
683 |
},
|
684 |
"orig_nbformat": 4,
|
685 |
"vscode": {
|
686 |
"interpreter": {
|
687 |
+
"hash": "644259c5c34406fc08905d9a77abc2e28422ee1d6f5c9d8d8683fb64864ae287"
|
688 |
}
|
689 |
}
|
690 |
},
|
app.py
CHANGED
@@ -16,4 +16,4 @@ iface = gr.Interface(predict, inputs = 'sketchpad',
|
|
16 |
outputs = 'text',
|
17 |
allow_flagging = 'never',
|
18 |
description = 'Draw a Digit Below... (Draw in the centre for best results)')
|
19 |
-
iface.launch(share = True, width =
|
16 |
outputs = 'text',
|
17 |
allow_flagging = 'never',
|
18 |
description = 'Draw a Digit Below... (Draw in the centre for best results)')
|
19 |
+
iface.launch(share = True, width = 300, height = 500)
|