WebashalarForML commited on
Commit
36ae850
·
verified ·
1 Parent(s): 1d55964

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +180 -228
templates/index.html CHANGED
@@ -4,281 +4,233 @@
4
  <head>
5
  <meta charset="UTF-8" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>AI Data Extractor</title>
 
8
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" />
9
  <style>
10
- body {
11
- background-color: #1c1c1e;
12
- font-family: "Poppins", sans-serif;
13
- color: #f5f5f7;
14
- margin: 0;
15
- }
16
-
17
- h1 {
18
- color: #e5e5e7;
19
- text-align: center;
20
- margin-bottom: 20px;
21
- }
22
-
23
- .container {
24
- margin-top: 70px;
25
  }
26
 
27
- .file-upload-section {
28
- background-color: #2c2c2e;
29
- padding: 30px;
30
- border-radius: 15px;
31
- box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  text-align: center;
33
  }
34
 
35
- .file-upload-section input[type="file"] {
36
- margin: 20px 0;
37
- }
38
-
39
- .file-upload-section input[type="submit"] {
40
- background-color: #ee4410;
41
- color: white;
42
- border: none;
43
- padding: 10px 20px;
44
- border-radius: 5px;
45
- transition: background-color 0.3s ease;
46
- }
47
-
48
- .file-upload-section input[type="submit"]:hover {
49
- background-color: #ee4410;
50
  }
51
 
52
- .file-actions a {
53
- margin: 0 10px;
 
 
 
 
 
 
54
  text-decoration: none;
55
- color: #ee4410;
56
  }
57
 
58
- .file-actions a:hover {
59
- color: #ee4410;
 
 
60
  }
61
 
62
- .flash-message {
63
- margin-bottom: 20px;
64
- padding: 15px;
65
- border-radius: 5px;
66
- color: #333;
67
  }
68
 
69
- .alert {
 
 
 
70
  text-align: center;
71
- position: sticky;
72
- top: 0;
73
- right: 15%;
74
- }
75
-
76
- /* Loader styles */
77
- .loader {
78
- border: 8px solid #f3f3f3;
79
- border-top: 8px solid #ee4410;
80
- border-radius: 50%;
81
- width: 60px;
82
- height: 60px;
83
- animation: spin 2s linear infinite;
84
- margin: 20px auto;
85
- display: none;
86
  }
87
 
88
- @keyframes spin {
89
- 0% {
90
- transform: rotate(0deg);
91
- }
92
-
93
- 100% {
94
- transform: rotate(360deg);
95
- }
96
  }
97
 
98
- /* Top bar styles */
99
- .top-bar {
100
- background-color: #333;
101
- position: fixed;
102
- top: 0;
 
 
 
 
103
  width: 100%;
104
- z-index: 1000;
105
- padding: 10px 20px;
106
- display: flex;
107
- justify-content: space-between;
108
- align-items: center;
109
  }
110
 
111
- .top-bar h2 {
112
- color: white;
 
113
  }
114
 
115
- /* Navigation tab styles */
116
- .tab {
117
- display: flex;
118
- gap: 10px;
119
  }
120
 
121
- .tab button {
122
- background-color: inherit;
123
- border: none;
124
- outline: none;
125
- cursor: pointer;
126
- padding: 10px 16px;
127
- transition: 0.3s;
128
- font-size: 17px;
129
- color: white;
130
  }
131
 
132
- .tab button:hover {
133
- background-color: #575757;
134
- cursor: pointer;
135
- }
136
 
137
- .tab button.active {
138
- background-color: #ee4410;
 
 
 
 
 
 
139
  }
140
 
141
- /* Tab content styles */
142
- .tabcontent {
143
- display: none;
144
- padding: 20px;
145
- margin-top: 70px;
146
- }
147
- .disabled {
148
- cursor: not-allowed !important;
149
- opacity: 0.6;/* Set cursor to not-allowed */
150
- }
151
-
152
- /* Responsive design */
153
- @media (max-width: 768px) {
154
- .tab {
155
- flex-direction: column;
156
- }
157
  }
158
  </style>
159
  </head>
160
 
161
  <body>
162
- <!-- Locked Top Bar with Tabs -->
163
- <div class="top-bar">
164
- <h2>AI Data Extractor</h2>
165
- <!-- Navigation Tabs -->
166
- <div class="tab">
167
- <button class="tablinks active" onclick="openLink('https://webashalarforml-imagedataextractor2.hf.space/', this, '#ff4d00')" id="defaultOpen">Visiting Card Data Extractor</button>
168
- <button class="tablinks" onclick="openLink('https://webashalarforml-resumeextractor2.hf.space/', this, '#ff4d00')">Resume Data Extractor</button>
169
- </div>
170
- </div>
171
- <div class="container">
172
- <h1>Visiting Card Data Extractor</h1>
173
- <div class="file-upload-section">
174
- <form id="fileUploadForm" action="{{ url_for('upload_file') }}" method="POST" enctype="multipart/form-data">
175
- <input type="file" name="files" multiple class="form-control" required />
176
- <input type="submit" value="Upload your Images" class="btn btn-outline-primary" />
177
- </form>
178
-
179
- {% if session.get('uploaded_files') %}
180
- <p class="mt-4">
181
- Uploaded:
182
- <span class="text-danger">{{ session.get('uploaded_files') }}</span>
183
- </p>
184
- <form action="{{ url_for('remove_file') }}" method="post">
185
- <button type="submit" class="btn btn-outline-danger">
186
- <i class="bi bi-trash"></i> Remove Uploaded File
187
- </button>
188
- </form>
189
- {% endif %}
190
- </div>
191
-
192
- <div class="container">
193
- <!-- Loader -->
194
- <div class="loader" id="loader"></div>
195
  </div>
 
196
 
197
- {% with messages = get_flashed_messages() %} {% if messages %}
198
- <div class="alert alert-success mt-4" id="flash-message">
199
- {{ messages[0] }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  </div>
201
- {% endif %} {% endwith %}
202
  </div>
203
 
204
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
205
  <script>
206
- // Loader functionality
207
- document.getElementById('fileUploadForm').onsubmit = function() {
208
- document.getElementById('loader').style.display = 'block';
209
-
210
- // Disable the tab buttons and apply disabled class
211
- const buttons = document.querySelectorAll('.tab button');
212
- buttons.forEach(button => {
213
- button.setAttribute('disabled', 'true');
214
- button.classList.add('disabled'); // Add disabled class
215
- });
216
-
217
- // Show processing message
218
- const processingMessage = document.createElement('p');
219
- processingMessage.id = 'processing-message';
220
- processingMessage.textContent = 'Processing, please wait...';
221
- processingMessage.style.color = '#e68a10'; // Style as needed
222
- document.querySelector('.file-upload-section').appendChild(processingMessage);
223
  };
224
-
225
  // Flash message auto-hide
226
- setTimeout(function () {
227
- let flashMessage = document.getElementById("flash-message");
228
- if (flashMessage) {
229
- flashMessage.style.transition = "opacity 1s ease";
230
- flashMessage.style.opacity = 0;
231
- setTimeout(() => flashMessage.remove(), 1000);
232
- }
233
-
234
- // After processing is complete (You can adjust this based on your logic)
235
- const processingMessage = document.getElementById('processing-message');
236
- if (processingMessage) {
237
- processingMessage.remove(); // Remove the processing message
238
- }
239
-
240
- // Re-enable tab buttons and remove disabled class
241
- const buttons = document.querySelectorAll('.tab button');
242
- buttons.forEach(button => {
243
- button.removeAttribute('disabled');
244
- button.classList.remove('disabled'); // Remove disabled class
245
- });
246
- }, 3000); // Adjust timing based on your upload duration
247
-
248
- // Function to open links in the same tab
249
- function openLink(url, element) {
250
- window.location.href = url; // Redirects to the specified URL in the same tab
251
-
252
- // Remove "active" class from all buttons
253
- const buttons = document.querySelectorAll('.tab button');
254
- buttons.forEach(button => button.classList.remove('active'));
255
-
256
- // Add "active" class to the clicked button
257
- element.classList.add('active');
258
- }
259
- //Refreshing the cookie
260
- function setCookie(name, value, days) {
261
- let expires = "";
262
- if (days) {
263
- const date = new Date();
264
- date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
265
- expires = "; expires=" + date.toUTCString();
266
  }
267
- document.cookie = name + "=" + (value || "") + expires + "; path=/";
268
- }
269
-
270
- function deleteCookie(name) {
271
- document.cookie = name + '=; Max-Age=0; path=/;'; // Delete the cookie
272
- }
273
-
274
- // Set the cookie (you can comment this out after testing)
275
- setCookie('myCookie', 'myValue', 1); // Sets a cookie for demonstration
276
-
277
- // Automatically delete the cookie when the page is loaded or refreshed
278
- window.onload = function() {
279
- deleteCookie('myCookie'); // Replace 'myCookie' with your cookie name
280
- }
281
  </script>
282
  </body>
283
-
284
  </html>
 
4
  <head>
5
  <meta charset="UTF-8" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>AI Data Extractor - Visiting Card</title>
8
+ <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap" rel="stylesheet">
9
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" />
10
  <style>
11
+ :root {
12
+ --primary: #ee4410;
13
+ --secondary: #ff9f0a;
14
+ --bg-dark: #0a0a0c;
15
+ --card-bg: rgba(30, 30, 35, 0.7);
16
+ --text-glow: 0 0 10px rgba(238, 68, 16, 0.5);
 
 
 
 
 
 
 
 
 
17
  }
18
 
19
+ body {
20
+ background-color: var(--bg-dark);
21
+ font-family: 'Outfit', sans-serif;
22
+ color: #f5f5f7;
23
+ overflow-x: hidden;
24
+ background: radial-gradient(circle at 50% 50%, #1a1a1f 0%, #0a0a0c 100%);
25
+ min-height: 100vh;
26
+ }
27
+
28
+ .glass-card {
29
+ background: var(--card-bg);
30
+ backdrop-filter: blur(12px);
31
+ border: 1px solid rgba(255, 255, 255, 0.1);
32
+ border-radius: 20px;
33
+ box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
34
+ padding: 2.5rem;
35
+ margin-top: 2rem;
36
+ }
37
+
38
+ .premium-title {
39
+ background: linear-gradient(135deg, #fff 0%, #aaa 100%);
40
+ -webkit-background-clip: text;
41
+ background-clip: text;
42
+ -webkit-text-fill-color: transparent;
43
+ font-weight: 600;
44
+ letter-spacing: -1px;
45
+ text-shadow: var(--text-glow);
46
+ margin-bottom: 2rem;
47
  text-align: center;
48
  }
49
 
50
+ .top-bar {
51
+ background: rgba(20, 20, 25, 0.8);
52
+ backdrop-filter: blur(10px);
53
+ padding: 1rem 2rem;
54
+ border-bottom: 1px solid rgba(255, 255, 255, 0.05);
55
+ position: sticky;
56
+ top: 0;
57
+ z-index: 1000;
 
 
 
 
 
 
 
58
  }
59
 
60
+ .tab-btn {
61
+ background: transparent;
62
+ border: 1px solid rgba(255, 255, 255, 0.1);
63
+ color: #8e8e93;
64
+ padding: 0.6rem 1.2rem;
65
+ border-radius: 30px;
66
+ margin-right: 10px;
67
+ transition: all 0.3s ease;
68
  text-decoration: none;
69
+ font-size: 0.9rem;
70
  }
71
 
72
+ .tab-btn:hover, .tab-btn.active {
73
+ border-color: var(--primary);
74
+ color: #fff;
75
+ background: rgba(238, 68, 16, 0.1);
76
  }
77
 
78
+ .tab-btn.active {
79
+ box-shadow: 0 0 15px rgba(238, 68, 16, 0.2);
 
 
 
80
  }
81
 
82
+ .upload-area {
83
+ border: 2px dashed rgba(255, 255, 255, 0.1);
84
+ border-radius: 15px;
85
+ padding: 3rem;
86
  text-align: center;
87
+ transition: all 0.3s ease;
88
+ cursor: pointer;
89
+ margin-bottom: 2rem;
 
 
 
 
 
 
 
 
 
 
 
 
90
  }
91
 
92
+ .upload-area:hover {
93
+ border-color: var(--primary);
94
+ background: rgba(238, 68, 16, 0.05);
 
 
 
 
 
95
  }
96
 
97
+ .btn-premium {
98
+ background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
99
+ border: none;
100
+ color: white;
101
+ padding: 0.8rem 2rem;
102
+ border-radius: 30px;
103
+ font-weight: 600;
104
+ box-shadow: 0 5px 15px rgba(238, 68, 16, 0.3);
105
+ transition: all 0.3s ease;
106
  width: 100%;
 
 
 
 
 
107
  }
108
 
109
+ .btn-premium:hover:not(:disabled) {
110
+ transform: scale(1.02);
111
+ box-shadow: 0 8px 25px rgba(238, 68, 16, 0.5);
112
  }
113
 
114
+ .btn-premium:disabled {
115
+ opacity: 0.6;
116
+ cursor: not-allowed;
 
117
  }
118
 
119
+ .loader {
120
+ display: none;
121
+ width: 40px;
122
+ height: 40px;
123
+ border: 3px solid rgba(255,255,255,0.1);
124
+ border-top: 3px solid var(--primary);
125
+ border-radius: 50%;
126
+ animation: spin 1s linear infinite;
127
+ margin: 2rem auto;
128
  }
129
 
130
+ @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
 
 
 
131
 
132
+ .alert-premium {
133
+ background: rgba(40, 40, 45, 0.9);
134
+ border: 1px solid var(--primary);
135
+ color: #fff;
136
+ border-radius: 12px;
137
+ padding: 1rem;
138
+ margin-top: 1.5rem;
139
+ text-align: center;
140
  }
141
 
142
+ .file-list {
143
+ margin-top: 1.5rem;
144
+ padding: 1rem;
145
+ background: rgba(0, 0, 0, 0.2);
146
+ border-radius: 10px;
147
+ font-size: 0.9rem;
 
 
 
 
 
 
 
 
 
 
148
  }
149
  </style>
150
  </head>
151
 
152
  <body>
153
+ <div class="top-bar d-flex justify-content-between align-items-center">
154
+ <h4 class="mb-0 text-white" style="font-weight: 600; letter-spacing: -0.5px;">AI EXtractor</h4>
155
+ <div class="d-none d-md-flex">
156
+ <a href="#" class="tab-btn active">Visiting Card</a>
157
+ <a href="https://webashalarforml-resumeextractor2.hf.space/" class="tab-btn">Resume Detail</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  </div>
159
+ </div>
160
 
161
+ <div class="container py-5">
162
+ <div class="row justify-content-center">
163
+ <div class="col-lg-6">
164
+ <div class="glass-card">
165
+ <h1 class="premium-title">Card Scanner <small style="display: block; font-size: 0.4em; letter-spacing: 2px; color: var(--primary); margin-top: 5px;">POWERED BY GROQ VLM</small></h1>
166
+
167
+ <form id="uploadForm" action="{{ url_for('upload_file') }}" method="POST" enctype="multipart/form-data">
168
+ <div class="upload-area" onclick="document.getElementById('fileInput').click()">
169
+ <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" class="bi bi-cloud-upload text-muted mb-3" viewBox="0 0 16 16">
170
+ <path fill-rule="evenodd" d="M4.406 3.342A5.53 5.53 0 0 1 8 2c2.69 0 4.923 2 5.166 4.579C14.758 6.804 16 8.137 16 9.773 16 11.569 14.502 13 12.687 13H3.781C1.708 13 0 11.366 0 9.318c0-1.763 1.266-3.223 2.942-3.593.143-.863.698-1.723 1.464-2.383zm.653.757c-.757.653-1.153 1.44-1.153 2.056v.448l-.445.049C2.064 6.805 1 7.952 1 9.318 1 10.785 2.23 12 3.781 12h8.906C13.98 12 15 10.988 15 9.773c0-1.216-1.02-2.228-2.313-2.228h-.5v-.5C12.188 4.825 10.328 3 8 3a4.53 4.53 0 0 0-2.941 1.1z"/>
171
+ <path fill-rule="evenodd" d="M7.646 5.146a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1-.708.708L8.5 6.707V10.5a.5.5 0 0 1-1 0V6.707L6.354 7.854a.5.5 0 1 1-.708-.708l2-2z"/>
172
+ </svg>
173
+ <p class="mb-0 text-muted">Click or Drag & Drop Business Cards</p>
174
+ <input type="file" name="files" id="fileInput" multiple style="display: none;" required onchange="updateFileList(this)" />
175
+ </div>
176
+
177
+ <div id="fileList" class="file-list" style="display: none;"></div>
178
+
179
+ <button type="submit" id="submitBtn" class="btn-premium mt-3">Start Extraction</button>
180
+ </form>
181
+
182
+ <div class="loader" id="loader"></div>
183
+ <p id="loadingMsg" class="text-center text-muted small mt-2" style="display: none;">Analyzing images with AI engine...</p>
184
+
185
+ {% if session.get('uploaded_files') %}
186
+ <div class="mt-4 pt-3 border-top border-secondary">
187
+ <div class="d-flex justify-content-between align-items-center">
188
+ <span class="small text-muted">Ready to process: {{ session.get('uploaded_files')|length }} files</span>
189
+ <a href="{{ url_for('reset_upload') }}" class="text-danger small text-decoration-none">Clear All</a>
190
+ </div>
191
+ </div>
192
+ {% endif %}
193
+
194
+ {% with messages = get_flashed_messages() %}
195
+ {% if messages %}
196
+ <div class="alert-premium" id="flashMessage">
197
+ {{ messages[0] }}
198
+ </div>
199
+ {% endif %}
200
+ {% endwith %}
201
+ </div>
202
+ </div>
203
  </div>
 
204
  </div>
205
 
 
206
  <script>
207
+ function updateFileList(input) {
208
+ const list = document.getElementById('fileList');
209
+ if (input.files.length > 0) {
210
+ list.style.display = 'block';
211
+ list.innerHTML = '<strong>Selected:</strong><br>' +
212
+ Array.from(input.files).map(f => f.name).join('<br>');
213
+ } else {
214
+ list.style.display = 'none';
215
+ }
216
+ }
217
+
218
+ document.getElementById('uploadForm').onsubmit = function() {
219
+ document.getElementById('loader').style.display = 'block';
220
+ document.getElementById('loadingMsg').style.display = 'block';
221
+ document.getElementById('submitBtn').disabled = true;
222
+ document.getElementById('submitBtn').innerText = 'Processing...';
 
223
  };
224
+
225
  // Flash message auto-hide
226
+ setTimeout(() => {
227
+ const flash = document.getElementById('flashMessage');
228
+ if (flash) {
229
+ flash.style.transition = 'opacity 1s ease';
230
+ flash.style.opacity = '0';
231
+ setTimeout(() => flash.remove(), 1000);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
  }
233
+ }, 4000);
 
 
 
 
 
 
 
 
 
 
 
 
 
234
  </script>
235
  </body>
 
236
  </html>