forked from jwalapc/medico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ocr.html
308 lines (292 loc) · 8 KB
/
ocr.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="shortcut icon" href="images/Logo.png" sizes="16x16" type="image/x-icon">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link href="https://cdn.lineicons.com/3.0/lineicons.css" rel="stylesheet">
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css">
<meta name="viewport" content="with=device-width, initial-scale=1.0">
<title>OCR</title>
<link rel="stylesheet" href="cart.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Spartan:wght@300&display=swap" rel="stylesheet">
<script src="https://www.gstatic.com/firebasejs/ui/4.4.0/firebase-ui-auth.js"></script>
<script src='https://unpkg.com/[email protected]/dist/tesseract.min.js'></script>
</head>
<style>
#img{
margin-top: 30px;
height: 500px;
margin-left: 290px;
}
*{
margin: 0;
padding: 0;
font-family: 'Spartan', sans-serif;;
}
.header{
min-height: 100vh;
width: 100vw;
background-image: url(images/bg2.png);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
position: relative;
}
nav{
display: flex;
justify-content: space-between;
background-color: #53c68c;
max-height: 70px;
}
nav img{
margin-top: 0%;
height: 120px;
width: 120px;
}
.nav-links{
flex: 1;
text-align: right;
}
.nav-links ul li{
padding-top: 2%;
list-style: none;
display: inline-block;
padding-right: 7%;
position: relative;
}
.nav-links ul li a{
color: white;
text-decoration: none;
font-size: 16 px;
}
nav .fas{
display: none;
}
.gbtn{
background-color: transparent;
border: none;
color: #fff;
cursor: pointer;
}
/* SEARCH BAR*/
.nav-search{
width: 200px;
border-radius: 15px;
border: 1px #000 solid;
padding: 5px 5px 5px 25px;
top: 0;
left: 0;
z-index: 5;
}
.nav-search:hover{
transform: scale(1.05);
background-color: rgb(175, 211, 223);
}
@media(max-width: 1366px){
.header{
background-color: #fff;
overflow: hidden;
}
.nav-search{
width: 95%;
}
.nav-links ul li{
display: block;
}
.nav-links{
position: absolute;
background: #53c68c;
height: 100vh;
width: 200px;
top: 0;
right: -250px;
text-align: left;
z-index: 2;
transition: 1s;
}
nav .fas{
display: block;
color: #fff;
margin-top: 10%;
margin-right: 8%;
padding-right: 16px;
font-size: 15px;
cursor: pointer;
}
.nav-links ul{
padding: 30px;
}
}
@media screen and (max-width: 500px) {
.navbar a {
float: none;
display: block;
}
}
.navbar input[type=text] {
float: right;
padding: 6px;
background-color: white;
margin-top: 15px;
margin-right: 16px;
margin-left: 190 px;
padding-right: 5%;
border: 2px;
border-style: inset;
border-radius: 15px;
font-size: 17px;
color: black;
}
@media screen and (max-width: 600px) {
.navbar a, .navbar input[type=text] {
float: none;
display: block;
text-align: left;
width: 100%;
margin: 0;
padding: 14px;
}
.navbar input[type=text] {
border: 1px solid black;
}
}
.wrapper{
min-height: 100vh;
justify-content: center;
display: flex;
align-items: center;
}
.nav-search::placeholder{
color: black;
}
.nav-search::-webkit-input-placeholder{
color: black;
}
.s-btn{
font-size: 25px;
background-color: #53c68c;
border: none;
color: #fff;
cursor: pointer;
width: 120px;
height: 30px;
border-radius: 6px;
}
.s-btn:hover{
transform: scale(1.1);
background-color: red;
}
.i-btn{
margin-top: 30px;
margin-left: 450px;
}
.i-btn::-webkit-file-upload-button {
visibility: hidden;
}
.i-btn::before {
content: 'Upload Prescription';
display: inline-block;
background: linear-gradient(top, #f9f9f9, #e3e3e3);
border: 1px solid #999;
border-radius: 3px;
padding: 5px 8px;
outline: none;
white-space: nowrap;
cursor: pointer;
text-shadow: 1px 1px #fff;
font-weight: 700;
font-size: 10pt;
}
.i-btn:hover::before {
border-color: black;
}
.i-btn:active::before {
background: -webkit-linear-gradient(top, #e3e3e3, #f9f9f9);
}
</style>
<body>
<section class="header">
<nav>
<a href="#"><img src="images/Logo.png" alt=""></a>
<div class="nav-links" id="navLinks">
<i class="fas fa-times" onclick="hideMenu()"></i>
<ul>
<input type="text" class="nav-search" placeholder="Search..">
<li><a href="index.html"><i class="uil uil-estate"></i> Home</a></li>
<li><a href="offers.html"><i class="lni lni-offer"></i> Offers</a></li>
<li><button class="gbtn" onclick="loginWithGoogle()"><i class="fa fa-fw fa-user"></i> Login/ Sign-up</button></li>
<li><a href="#"><i class="uil uil-shopping-cart"></i> Cart</a></li>
</ul>
</div>
<script type="text/javascript">
function sign() {
console.log("sign");
}
</script>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.2.9/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.2.9/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.2.9/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.2.9/firebase-storage.js"></script>
<script>
// Your web app's Firebase configuration
var firebaseConfig = {
apiKey: "AIzaSyCmuvv_ew03FKSvxtVLIc_9OWcH6GjbO1w",
authDomain: "tcetdev.firebaseapp.com",
projectId: "tcetdev",
storageBucket: "tcetdev.appspot.com",
messagingSenderId: "323333761920",
appId: "1:323333761920:web:0c1ef126c2f6b301c0ef65",
measurementId: "G-0KHX2EJ3BR"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
</script>
<script src="./scripts/auth.js"></script>
<script src="./scripts/firestore-db.js"></script>
<i class="fas fa-bars" onclick="showMenu()"></i>
</nav>
<!--Javascript for toggle menu-->
<script>
var navLinks = document.getElementById("navLinks")
function showMenu(){
navLinks.style.right="0";
}
function hideMenu(){
navLinks.style.right="-200px";
}
</script>
<img src="images/Intro.gif" alt="image" id="img"> <br>
<input type="file" id="inpFile" onchange="loadFile(event)" class="i-btn">
<button id="btn" class="s-btn">Submit</button>
<br>
<p id="output"></p>
<script>
// to show image in img tag
const loadFile = (event) => {
var image = document.getElementById('img');
image.src = URL.createObjectURL(event.target.files[0]);
};
// when btn clicked recognize text
document.querySelector("#btn").onclick = async () => {
let inp = document.querySelector("#inpFile")
let output = document.querySelector("#output")
output.innerText = "Loading text"
try {
let text = await Tesseract.recognize(inp.files[0],
'eng'
)
console.log(text.data.text)
output.innerText = text.data.text
} catch (e) {
output.innerText = "ERROR: sorry try again"
}
}
</script>
</section>
</body>
</html>