Spaces:
Running
Running
Upload 5 files
Browse files- about.html +417 -0
- examples.html +483 -0
- index.html +620 -19
- recognizer.html +438 -0
- technology.html +451 -0
about.html
ADDED
|
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<!-- Add lang attribute and potentially 'dark' class -->
|
| 3 |
+
<html lang="en" class=""> <!-- Start without 'dark' initially -->
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>About the Project - NIC Project</title>
|
| 8 |
+
<!-- Tailwind CSS via CDN -->
|
| 9 |
+
<script src="https://cdn.tailwindcss.com/3.4.1"></script>
|
| 10 |
+
<script>
|
| 11 |
+
// *** Add dark mode strategy to Tailwind config ***
|
| 12 |
+
tailwind.config = {
|
| 13 |
+
darkMode: 'class', // Enable class-based dark mode
|
| 14 |
+
theme: {
|
| 15 |
+
extend: {
|
| 16 |
+
colors: {
|
| 17 |
+
primary: '#1a73e8',
|
| 18 |
+
secondary: '#e8f0fe',
|
| 19 |
+
// Define dark mode colors if needed, or rely on Tailwind's defaults
|
| 20 |
+
// dark: {
|
| 21 |
+
// background: '#1a202c',
|
| 22 |
+
// text: '#e2e8f0',
|
| 23 |
+
// }
|
| 24 |
+
},
|
| 25 |
+
borderRadius: {
|
| 26 |
+
'none': '0px', 'sm': '4px', DEFAULT: '8px', 'md': '12px',
|
| 27 |
+
'lg': '16px', 'xl': '20px', '2xl': '24px', '3xl': '32px',
|
| 28 |
+
'full': '9999px', 'button': '8px'
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
</script>
|
| 34 |
+
<!-- Fonts -->
|
| 35 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 36 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 37 |
+
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
|
| 38 |
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 39 |
+
<!-- Icons -->
|
| 40 |
+
<link href="https://cdn.jsdelivr.net/npm/remixicon@4.2.0/fonts/remixicon.css" rel="stylesheet">
|
| 41 |
+
<!-- Custom Styles -->
|
| 42 |
+
<style>
|
| 43 |
+
/* --- Font Definitions (Ensure loaded via <link> tags in base.html) --- */
|
| 44 |
+
body {
|
| 45 |
+
font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
| 46 |
+
-webkit-font-smoothing: antialiased; /* Smoother fonts */
|
| 47 |
+
-moz-osx-font-smoothing: grayscale;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.hindi-font {
|
| 51 |
+
font-family: 'Noto Sans Devanagari', sans-serif;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/* --- Custom Switch Styles (from provided HTML) --- */
|
| 55 |
+
.custom-switch {
|
| 56 |
+
position: relative;
|
| 57 |
+
display: inline-block;
|
| 58 |
+
width: 50px;
|
| 59 |
+
height: 24px;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.custom-switch-input {
|
| 63 |
+
opacity: 0;
|
| 64 |
+
width: 0;
|
| 65 |
+
height: 0;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.custom-switch-slider {
|
| 69 |
+
position: absolute;
|
| 70 |
+
cursor: pointer;
|
| 71 |
+
top: 0;
|
| 72 |
+
left: 0;
|
| 73 |
+
right: 0;
|
| 74 |
+
bottom: 0;
|
| 75 |
+
background-color: #ccc; /* Default off color */
|
| 76 |
+
transition: .4s;
|
| 77 |
+
border-radius: 34px; /* Rounded */
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.custom-switch-slider:before {
|
| 81 |
+
position: absolute;
|
| 82 |
+
content: "";
|
| 83 |
+
height: 18px;
|
| 84 |
+
width: 18px;
|
| 85 |
+
left: 3px;
|
| 86 |
+
bottom: 3px;
|
| 87 |
+
background-color: white; /* Changed from original rgb(136, 145, 212) to white for consistency with dark mode logic in base.html */
|
| 88 |
+
transition: .4s;
|
| 89 |
+
border-radius: 50%; /* Circle */
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
.custom-switch-input:checked + .custom-switch-slider {
|
| 93 |
+
background-color: #1a73e8; /* Primary color when on */
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.custom-switch-input:checked + .custom-switch-slider:before {
|
| 97 |
+
transform: translateX(26px); /* Move the circle */
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/* --- Accessibility: Ensure focus is visible --- */
|
| 101 |
+
/* Tailwind's default focus rings are usually good, but this is a fallback */
|
| 102 |
+
*:focus-visible {
|
| 103 |
+
outline: 2px solid #1a73e8; /* Use primary color for focus */
|
| 104 |
+
outline-offset: 2px;
|
| 105 |
+
box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.3); /* Optional softer focus ring */
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/* --- Other Minimal Custom Styles (if any) --- */
|
| 109 |
+
|
| 110 |
+
/* Example: Add a specific style for the example image containers if needed beyond grid/aspect ratio */
|
| 111 |
+
.example-image-container {
|
| 112 |
+
/* Custom styles here */
|
| 113 |
+
/* aspect-ratio: 3 / 2; */ /* Tailwind handles aspect ratio now */
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
.example-image {
|
| 117 |
+
/* Custom image styles here */
|
| 118 |
+
}
|
| 119 |
+
/* Add base dark mode styles */
|
| 120 |
+
html.dark body {
|
| 121 |
+
background-color: #1a202c; /* Example dark background */
|
| 122 |
+
color: #e2e8f0; /* Example dark text */
|
| 123 |
+
}
|
| 124 |
+
html.dark header, html.dark footer { /* Adjust header/footer */
|
| 125 |
+
background-color: #2d3748;
|
| 126 |
+
color: #e2e8f0;
|
| 127 |
+
}
|
| 128 |
+
html.dark .card { /* Adjust card styles */
|
| 129 |
+
background-color: #2d3748;
|
| 130 |
+
border-color: #4a5568;
|
| 131 |
+
}
|
| 132 |
+
html.dark h1, html.dark h2, html.dark h3, html.dark h4, html.dark h5, html.dark h6, html.dark p, html.dark span, html.dark li, html.dark label, html.dark small {
|
| 133 |
+
/* Adjust general text elements */
|
| 134 |
+
color: #e2e8f0; /* Light text */
|
| 135 |
+
}
|
| 136 |
+
html.dark .text-gray-600, html.dark .text-gray-700, html.dark .text-gray-800, html.dark .text-gray-900 {
|
| 137 |
+
color: #a0aec0; /* Lighter gray for dark mode */
|
| 138 |
+
}
|
| 139 |
+
html.dark .text-muted {
|
| 140 |
+
color: #718096;
|
| 141 |
+
}
|
| 142 |
+
html.dark .bg-white { background-color: #2d3748 !important; }
|
| 143 |
+
html.dark .bg-gray-50 { background-color: #1a202c !important; }
|
| 144 |
+
html.dark .bg-gray-100 { background-color: #2d3748 !important; }
|
| 145 |
+
html.dark .border-gray-100, html.dark .border-gray-200 { border-color: #4a5568 !important; }
|
| 146 |
+
html.dark .hover\:bg-gray-50:hover { background-color: #4a5568 !important; }
|
| 147 |
+
html.dark .navbar-dark .navbar-brand, html.dark .navbar-dark .nav-link { color: #fff; }
|
| 148 |
+
html.dark .navbar-dark .nav-link.active { color: #fff; font-weight: bold; }
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
</style>
|
| 152 |
+
|
| 153 |
+
</head>
|
| 154 |
+
<!-- Add dark mode background/text for body base -->
|
| 155 |
+
<body class="bg-gray-50 dark:bg-gray-900 min-h-screen flex flex-col text-gray-900 dark:text-gray-200">
|
| 156 |
+
|
| 157 |
+
<!-- Header -->
|
| 158 |
+
<header class="bg-white dark:bg-gray-800 shadow-sm sticky top-0 z-50">
|
| 159 |
+
<div class="container mx-auto px-4 py-3 flex items-center justify-between">
|
| 160 |
+
<div class="flex items-center">
|
| 161 |
+
<!-- Add data-lang attribute -->
|
| 162 |
+
<a href="/" class="text-2xl font-['Pacifico'] text-primary mr-8" data-lang-en="HindiOCR" data-lang-hi="हिन्दी ओसीआर">HindiOCR</a>
|
| 163 |
+
<nav class="hidden md:flex space-x-6">
|
| 164 |
+
<a href="/index.html"
|
| 165 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 166 |
+
data-lang-en="Home" data-lang-hi="होम">Home</a>
|
| 167 |
+
<a href="/recognizer.html"
|
| 168 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 169 |
+
data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a>
|
| 170 |
+
<a href="/examples.html"
|
| 171 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 172 |
+
data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a>
|
| 173 |
+
<a href="/technology.html"
|
| 174 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 175 |
+
data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a>
|
| 176 |
+
<a href="/about.html"
|
| 177 |
+
class="hover:text-primary dark:hover:text-blue-400 text-primary dark:text-blue-400 font-medium"
|
| 178 |
+
data-lang-en="About" data-lang-hi="बारे में">About</a>
|
| 179 |
+
</nav>
|
| 180 |
+
</div>
|
| 181 |
+
<!-- Right side header items -->
|
| 182 |
+
<div class="flex items-center space-x-4">
|
| 183 |
+
<!-- Language Switch -->
|
| 184 |
+
<div class="items-center space-x-2 hidden md:flex">
|
| 185 |
+
<span class="text-sm text-gray-600 dark:text-gray-400">EN</span>
|
| 186 |
+
<label class="custom-switch">
|
| 187 |
+
<!-- *** Add ID: languageToggle *** -->
|
| 188 |
+
<input type="checkbox" id="languageToggle" class="custom-switch-input">
|
| 189 |
+
<span class="custom-switch-slider"></span>
|
| 190 |
+
</label>
|
| 191 |
+
<span class="text-sm text-gray-600 dark:text-gray-400 hindi-font">हिंदी</span>
|
| 192 |
+
</div>
|
| 193 |
+
<!-- Theme Switch -->
|
| 194 |
+
<div class="items-center space-x-2 hidden md:flex">
|
| 195 |
+
<span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-sun-line"></i></span>
|
| 196 |
+
<label class="custom-switch">
|
| 197 |
+
<!-- *** Add ID: themeToggle *** -->
|
| 198 |
+
<input type="checkbox" id="themeToggle" class="custom-switch-input">
|
| 199 |
+
<span class="custom-switch-slider"></span>
|
| 200 |
+
</label>
|
| 201 |
+
<span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-moon-line"></i></span>
|
| 202 |
+
</div>
|
| 203 |
+
<!-- User/Notification Icons (Keep as placeholders) -->
|
| 204 |
+
<div class="w-10 h-10 flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-full cursor-pointer" title="User Profile (Placeholder)">
|
| 205 |
+
<i class="ri-user-line text-gray-600 dark:text-gray-300"></i>
|
| 206 |
+
</div>
|
| 207 |
+
<div class="w-10 h-10 flex items-center justify-center relative cursor-pointer" title="Notifications (Placeholder)">
|
| 208 |
+
<i class="ri-notification-3-line text-gray-600 dark:text-gray-300"></i>
|
| 209 |
+
<span class="absolute top-0 right-0 bg-red-500 text-white text-xs w-5 h-5 flex items-center justify-center rounded-full">3</span>
|
| 210 |
+
</div>
|
| 211 |
+
<!-- Mobile Menu Button (Placeholder) -->
|
| 212 |
+
<button class="md:hidden w-10 h-10 flex items-center justify-center" aria-label="Toggle Menu">
|
| 213 |
+
<i class="ri-menu-line text-gray-600 dark:text-gray-300 text-xl"></i>
|
| 214 |
+
</button>
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
</header>
|
| 218 |
+
|
| 219 |
+
<!-- Main Content Area -->
|
| 220 |
+
<main class="flex-grow">
|
| 221 |
+
|
| 222 |
+
<div class="container mx-auto px-4 py-8">
|
| 223 |
+
<div class="max-w-3xl mx-auto">
|
| 224 |
+
<!-- Apply dark mode classes to the card -->
|
| 225 |
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-700 overflow-hidden">
|
| 226 |
+
<!-- Apply dark mode classes to the header -->
|
| 227 |
+
<div class="px-6 py-4 bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600">
|
| 228 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white flex items-center">
|
| 229 |
+
<i class="ri-information-line mr-2 text-primary text-2xl"></i>
|
| 230 |
+
<!-- Add attributes to the title span -->
|
| 231 |
+
<span data-lang-en="About This Project" data-lang-hi="इस परियोजना के बारे में">About This Project</span>
|
| 232 |
+
</h2>
|
| 233 |
+
</div>
|
| 234 |
+
<!-- Apply dark mode classes to text elements in the body -->
|
| 235 |
+
<div class="p-6 md:p-8 space-y-6 text-gray-700 dark:text-gray-300 leading-relaxed">
|
| 236 |
+
<h3 class="text-2xl font-semibold text-gray-900 dark:text-white mb-3" data-lang-en="Devanagari Handwritten Word Recognition" data-lang-hi="देवनागरी हस्तलिखित शब्द पहचान">Devanagari Handwritten Word Recognition</h3>
|
| 237 |
+
<p data-lang-en="This project demonstrates the application of deep learning techniques for recognizing handwritten words in the Devanagari script. It was developed as a Final Year Project under the guidance of the National Informatics Centre (NIC), aiming to create a practical tool for showcasing OCR capabilities for Indic scripts." data-lang-hi="यह परियोजना देवनागरी लिपि में हस्तलिखित शब्दों को पहचानने के लिए डीप लर्निंग तकनीकों के अनुप्रयोग का प्रदर्शन करती है। इसे राष्ट्रीय सूचना विज्ञान केंद्र (एनआईसी) के मार्गदर्शन में अंतिम वर्ष की परियोजना के रूप में विकसित किया गया था, जिसका लक्ष्य भारतीय लिपियों के लिए ओसीआर क्षमताओं को प्रदर्शित करने के लिए एक व्यावहारिक उपकरण बनाना था।">
|
| 238 |
+
This project demonstrates the application of deep learning techniques for recognizing handwritten words in the Devanagari script. It was developed as a Final Year Project under the guidance of the National Informatics Centre (NIC), aiming to create a practical tool for showcasing OCR capabilities for Indic scripts.
|
| 239 |
+
</p>
|
| 240 |
+
<hr class="my-6 border-gray-200 dark:border-gray-600">
|
| 241 |
+
|
| 242 |
+
<h4 class="text-xl font-semibold text-gray-800 dark:text-white" data-lang-en="Motivation" data-lang-hi="प्रेरणा">Motivation</h4>
|
| 243 |
+
<p data-lang-en="India possesses a vast repository of historical documents, government records, and literature primarily written in Devanagari and other Brahmi-derived scripts. Manually processing and digitizing these valuable handwritten resources is a significant challenge – often slow, costly, and prone to errors. While Optical Character Recognition (OCR) offers a technological solution, generic OCR systems frequently struggle with the complexities of Indic scripts like Devanagari. Unique features such as mandatory header lines (shirorekha), vowel modifiers (matras), conjunct characters, and variations in handwriting styles necessitate specialized models. This project addresses this gap by focusing specifically on building and demonstrating a model for isolated handwritten Devanagari words." data-lang-hi="भारत में ऐतिहासिक दस्तावेजों, सरकारी रिकॉर्ड और साहित्य का एक विशाल भंडार है जो मुख्य रूप से देवनागरी और अन्य ब्राह्मी-व्युत्पन्न लिपियों में लिखा गया है। इन मूल्यवान हस्तलिखित संसाधनों को मैन्युअल रूप से संसाधित करना और डिजिटाइज़ करना एक महत्वपूर्ण चुनौती है - अक्सर धीमा, महंगा और त्रुटियों से भरा होता है। जबकि ऑप्टिकल कैरेक्टर र��कग्निशन (ओसीआर) एक तकनीकी समाधान प्रदान करता है, सामान्य ओसीआर सिस्टम अक्सर देवनागरी जैसी जटिल भारतीय लिपियों की जटिलताओं से जूझते हैं। अनिवार्य शीर्षक रेखा (शिरोरेखा), स्वर संशोधक (मात्रा), संयुक्ताक्षर और लिखावट शैलियों में भिन्नता जैसी अनूठी विशेषताओं के लिए विशेष मॉडल की आवश्यकता होती है। यह परियोजना विशेष रूप से पृथक हस्तलिखित देवनागरी शब्दों के लिए एक मॉडल बनाने और प्रदर्शित करने पर ध्यान केंद्रित करके इस अंतर को संबोधित करती है।">
|
| 244 |
+
India possesses a vast repository of historical documents, government records, and literature primarily written in Devanagari and other Brahmi-derived scripts. Manually processing and digitizing these valuable handwritten resources is a significant challenge – often slow, costly, and prone to errors. While Optical Character Recognition (OCR) offers a technological solution, generic OCR systems frequently struggle with the complexities of Indic scripts like Devanagari. Unique features such as mandatory header lines (shirorekha), vowel modifiers (matras), conjunct characters, and variations in handwriting styles necessitate specialized models. This project addresses this gap by focusing specifically on building and demonstrating a model for isolated handwritten Devanagari words.
|
| 245 |
+
</p>
|
| 246 |
+
|
| 247 |
+
<h4 class="text-xl font-semibold text-gray-800 dark:text-white mt-4" data-lang-en="Objectives" data-lang-hi="उद्देश्य">Objectives</h4>
|
| 248 |
+
<ul class="list-disc list-inside space-y-1 text-gray-700 dark:text-gray-300">
|
| 249 |
+
<li data-lang-en="Develop and implement a deep learning model (Convolutional + Recurrent Neural Network with CTC loss) tailored for handwritten Devanagari word recognition." data-lang-hi="हस्तलिखित देवनागरी शब्द पहचान के लिए तैयार किए गए डीप लर्निंग मॉडल (सीटीसी लॉस के साथ कन्वेन्शनल + रिकरंट न्यूरल नेटवर्क) का विकास और कार्यान्वयन करना।">Develop and implement a deep learning model (Convolutional + Recurrent Neural Network with CTC loss) tailored for handwritten Devanagari word recognition.</li>
|
| 250 |
+
<li data-lang-en="Create an intuitive and accessible web-based interface for demonstrating the model's recognition capabilities using user-uploaded images or provided examples." data-lang-hi="उपयोगकर्ता द्वारा अपलोड की गई छवियों या प्रदान किए गए उदाहरणों का उपयोग करके मॉडल की पहचान क्षमताओं को प्रदर्शित करने के लिए एक सहज और सुलभ वेब-आधारित इंटरफ़ेस बनाना।">Create an intuitive and accessible web-based interface for demonstrating the model's recognition capabilities using user-uploaded images or provided examples.</li>
|
| 251 |
+
<li data-lang-en="Evaluate the performance and accuracy of the developed OCR model on relevant test data." data-lang-hi="प्रासंगिक परीक्षण डेटा पर विकसित ओसीआर मॉडल के प्रदर्शन और सटीकता का मूल्यांकन करना।">Evaluate the performance and accuracy of the developed OCR model on relevant test data.</li>
|
| 252 |
+
<li data-lang-en="Highlight the potential applicability of such specialized OCR technology in the context of digitizing handwritten records and improving data processing within government and public sector domains, relevant to NIC's mission." data-lang-hi="एनआईसी के मिशन के लिए प्रासंगिक सरकारी और सार्वजनिक क्षेत्र के डोमेन के भीतर हस्तलिखित रिकॉर्ड को डिजिटाइज़ करने और डेटा प्रोसेसिंग में सुधार के संदर्भ में ऐसी विशेष ओसीआर तकनीक की संभावित प्रयोज्यता क�� उजागर करना।">Highlight the potential applicability of such specialized OCR technology in the context of digitizing handwritten records and improving data processing within government and public sector domains, relevant to NIC's mission.</li>
|
| 253 |
+
</ul>
|
| 254 |
+
|
| 255 |
+
<h4 class="text-xl font-semibold text-gray-800 dark:text-white mt-4" data-lang-en="Potential Relevance (NIC Context)" data-lang-hi="संभावित प्रासंगिकता (एनआईसी संदर्भ)">Potential Relevance (NIC Context)</h4>
|
| 256 |
+
<p data-lang-en="Accurate and efficient Devanagari OCR technology holds significant potential to support various NIC initiatives and e-Governance goals under the Digital India programme. Key applications include:" data-lang-hi="सटीक और कुशल देवनागरी ओसीआर तकनीक में डिजिटल इंडिया कार्यक्रम के तहत विभिन्न एनआईसी पहलों और ई-गवर्नेंस लक्ष्यों का समर्थन करने की महत्वपूर्ण क्षमता है। मुख्य अनुप्रयोगों में शामिल हैं:">
|
| 257 |
+
Accurate and efficient Devanagari OCR technology holds significant potential to support various NIC initiatives and e-Governance goals under the Digital India programme. Key applications include:
|
| 258 |
+
</p>
|
| 259 |
+
<ul class="list-disc list-inside space-y-1 text-gray-700 dark:text-gray-300">
|
| 260 |
+
<li data-lang-en="**Digitization of Archives:** Accelerating the conversion of legacy paper-based government records, historical manuscripts, and official archives into searchable digital formats." data-lang-hi="**अभिलेखागार का डिजिटलीकरण:** पुराने कागज-आधारित सरकारी रिकॉर्ड, ऐतिहासिक पांडुलिपियों और आधिकारिक अभिलेखागार के खोज योग्य डिजिटल प्रारूपों में रूपांतरण को तेज करना।">**Digitization of Archives:** Accelerating the conversion of legacy paper-based government records, historical manuscripts, and official archives into searchable digital formats.</li>
|
| 261 |
+
<li data-lang-en="**Improved Data Entry:** Streamlining processes that involve capturing information from handwritten forms (e.g., census data, surveys, application forms)." data-lang-hi="**बेहतर डेटा प्रविष्टि:** हस्तलिखित प्रपत्रों (जैसे, जनगणना डेटा, सर्वेक्षण, आवेदन पत्र) से जानकारी प्राप्त करने वाली प्रक्रियाओं को सुव्यवस्थित करना।">**Improved Data Entry:** Streamlining processes that involve capturing information from handwritten forms (e.g., census data, surveys, application forms).</li>
|
| 262 |
+
<li data-lang-en="**Enhanced Searchability:** Enabling full-text search across large volumes of previously inaccessible handwritten documents." data-lang-hi="**बढ़ी हुई खोज क्षमता:** पहले से दुर्गम हस्तलिखित दस्तावेजों के बड़े संस्करणों में पूर्ण-पाठ खोज को सक्षम करना।">**Enhanced Searchability:** Enabling full-text search across large volumes of previously inaccessible handwritten documents.</li>
|
| 263 |
+
<li data-lang-en="**Accessibility:** Supporting initiatives to make information more accessible by converting handwritten materials into machine-readable text that can be used with assistive technologies." data-lang-hi="**सरल उपयोग:** हस्तलिखित सामग्री को मशीन-पठनीय पाठ में परिवर्तित करके जानकारी को अधिक सुलभ बनाने की पहल का समर्थन करना जिसका उपयोग सहायक तकनीकों के साथ किया जा सकता है।">**Accessibility:** Supporting initiatives to make information more accessible by converting handwritten materials into machine-readable text that can be used with assistive technologies.</li>
|
| 264 |
+
</ul>
|
| 265 |
+
|
| 266 |
+
<!-- Updated Name - decide if you want language toggle for the name -->
|
| 267 |
+
<!-- Option 1: Always Hindi -->
|
| 268 |
+
<!-- <p class="mt-6 text-center text-sm text-gray-500 dark:text-gray-400">
|
| 269 |
+
यशस्विनी खानसामा
|
| 270 |
+
</p> -->
|
| 271 |
+
|
| 272 |
+
<!-- Option 2: Switchable Name -->
|
| 273 |
+
<p class="mt-6 text-center text-sm text-gray-500 dark:text-gray-400" data-lang-en="Yashaswini Khansama" data-lang-hi="यशस्विनी खानसामा">
|
| 274 |
+
Yashaswini Khansama
|
| 275 |
+
</p>
|
| 276 |
+
|
| 277 |
+
</div>
|
| 278 |
+
</div>
|
| 279 |
+
</div>
|
| 280 |
+
</div>
|
| 281 |
+
|
| 282 |
+
</main>
|
| 283 |
+
|
| 284 |
+
<!-- Footer -->
|
| 285 |
+
<footer class="bg-gray-900 text-gray-400 py-12"> <!-- Adjusted footer text color -->
|
| 286 |
+
<div class="container mx-auto px-4">
|
| 287 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
| 288 |
+
<div>
|
| 289 |
+
<!-- Add data-lang attributes to footer elements if needed -->
|
| 290 |
+
<a href="/" class="text-2xl font-['Pacifico'] text-white mb-4 inline-block" data-lang-en="HindiOCR" data-lang-hi="हिन्दी ओसीआर">HindiOCR</a>
|
| 291 |
+
<p class="mb-4 text-sm" data-lang-en="Transforming handwritten Hindi documents into digital text." data-lang-hi="हस्तलिखित हिंदी दस्तावेज़ों को डिजिटल टेक्स्ट में बदलना।">Transforming handwritten Hindi documents into digital text.</p>
|
| 292 |
+
<div class="flex space-x-4">
|
| 293 |
+
<a href="#" class="hover:text-white" title="GitHub (Placeholder)"><i class="ri-github-fill"></i></a>
|
| 294 |
+
<a href="#" class="hover:text-white" title="LinkedIn (Placeholder)"><i class="ri-linkedin-box-fill"></i></a>
|
| 295 |
+
</div>
|
| 296 |
+
</div>
|
| 297 |
+
<div>
|
| 298 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Quick Links" data-lang-hi="त्वरित लिंक्स">Quick Links</h3>
|
| 299 |
+
<ul class="space-y-2 text-sm">
|
| 300 |
+
<li><a href="/" class="hover:text-white" data-lang-en="Home" data-lang-hi="होम">Home</a></li>
|
| 301 |
+
<li><a href="/recognize" class="hover:text-white" data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a></li>
|
| 302 |
+
<li><a href="/examples" class="hover:text-white" data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a></li>
|
| 303 |
+
<li><a href="/technology" class="hover:text-white" data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a></li>
|
| 304 |
+
<li><a href="/about" class="hover:text-white" data-lang-en="About" data-lang-hi="बारे में">About</a></li>
|
| 305 |
+
</ul>
|
| 306 |
+
</div>
|
| 307 |
+
<div>
|
| 308 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Resources" data-lang-hi="संसाधन">Resources</h3>
|
| 309 |
+
<ul class="space-y-2 text-sm">
|
| 310 |
+
<li><a href="#" class="hover:text-white" data-lang-en="Documentation (TBD)" data-lang-hi="प्रलेखन (TBD)">Documentation (TBD)</a></li>
|
| 311 |
+
<li><a href="#" class="hover:text-white" data-lang-en="GitHub Repo (Link)" data-lang-hi="गिटहब रेपो (लिंक)">GitHub Repo (Link)</a></li>
|
| 312 |
+
<li><a href="#" class="hover:text-white" data-lang-en="Support (TBD)" data-lang-hi="समर्थन (TBD)">Support (TBD)</a></li>
|
| 313 |
+
</ul>
|
| 314 |
+
</div>
|
| 315 |
+
<div>
|
| 316 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Contact (Project)" data-lang-hi="संपर्क (परियोजना)">Contact (Project)</h3>
|
| 317 |
+
<ul class="space-y-2 text-sm">
|
| 318 |
+
<li class="flex items-start">
|
| 319 |
+
<i class="ri-mail-line mt-1 mr-2"></i>
|
| 320 |
+
<span>khansamayashaswini@gmail.com</span>
|
| 321 |
+
</li>
|
| 322 |
+
<li class="flex items-center">
|
| 323 |
+
<i class="ri-building-line mr-2"></i>
|
| 324 |
+
<span>MATS University,Raipur / NIC Durg</span>
|
| 325 |
+
</li>
|
| 326 |
+
</ul>
|
| 327 |
+
</div>
|
| 328 |
+
</div>
|
| 329 |
+
<!-- Copyright -->
|
| 330 |
+
<div class="border-t border-gray-700 mt-8 pt-8 text-center">
|
| 331 |
+
<p class="text-sm">© 2025 Yashaswini khansama | Final Year Project | NIC</p>
|
| 332 |
+
</div>
|
| 333 |
+
</div>
|
| 334 |
+
</footer>
|
| 335 |
+
|
| 336 |
+
<!-- Bootstrap JS Bundle (Not needed for Tailwind, can remove if not used elsewhere) -->
|
| 337 |
+
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> -->
|
| 338 |
+
|
| 339 |
+
<!-- Base Theme/Language Script -->
|
| 340 |
+
<script>
|
| 341 |
+
// --- Theme Toggle ---
|
| 342 |
+
const themeToggle = document.getElementById('themeToggle');
|
| 343 |
+
const htmlElement = document.documentElement; // Target <html> tag
|
| 344 |
+
|
| 345 |
+
// Function to apply theme based on preference
|
| 346 |
+
function applyTheme(isDark) {
|
| 347 |
+
if (isDark) {
|
| 348 |
+
htmlElement.classList.add('dark');
|
| 349 |
+
if(themeToggle) themeToggle.checked = true;
|
| 350 |
+
console.log("Theme applied: dark");
|
| 351 |
+
} else {
|
| 352 |
+
htmlElement.classList.remove('dark');
|
| 353 |
+
if(themeToggle) themeToggle.checked = false;
|
| 354 |
+
console.log("Theme applied: light");
|
| 355 |
+
}
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
// Check localStorage on load
|
| 359 |
+
const prefersDark = localStorage.getItem('theme') === 'dark' ||
|
| 360 |
+
(localStorage.getItem('theme') === null && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
| 361 |
+
applyTheme(prefersDark);
|
| 362 |
+
|
| 363 |
+
// Add listener to toggle button
|
| 364 |
+
if(themeToggle){
|
| 365 |
+
themeToggle.addEventListener('change', (event) => {
|
| 366 |
+
const isDark = event.target.checked;
|
| 367 |
+
applyTheme(isDark);
|
| 368 |
+
// Save preference to localStorage
|
| 369 |
+
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
| 370 |
+
});
|
| 371 |
+
} else {
|
| 372 |
+
console.warn("Theme toggle button not found.");
|
| 373 |
+
}
|
| 374 |
+
|
| 375 |
+
// --- Language Toggle (Simple Version) ---
|
| 376 |
+
const languageToggle = document.getElementById('languageToggle');
|
| 377 |
+
const langElements = document.querySelectorAll('[data-lang-en]'); // Select elements with language data
|
| 378 |
+
|
| 379 |
+
// Function to apply language
|
| 380 |
+
function applyLanguage(lang) { // lang should be 'en' or 'hi'
|
| 381 |
+
console.log("Applying language:", lang);
|
| 382 |
+
htmlElement.setAttribute('lang', lang); // Set overall page lang
|
| 383 |
+
|
| 384 |
+
langElements.forEach(el => {
|
| 385 |
+
const text = el.getAttribute(`data-lang-${lang}`);
|
| 386 |
+
if (text) {
|
| 387 |
+
el.textContent = text; // Replace text content
|
| 388 |
+
}
|
| 389 |
+
});
|
| 390 |
+
|
| 391 |
+
// Update toggle state
|
| 392 |
+
if (languageToggle) languageToggle.checked = (lang === 'hi');
|
| 393 |
+
|
| 394 |
+
// Save preference
|
| 395 |
+
localStorage.setItem('language', lang);
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
// Check localStorage on load for language
|
| 399 |
+
const savedLang = localStorage.getItem('language') || 'en'; // Default to English
|
| 400 |
+
applyLanguage(savedLang);
|
| 401 |
+
|
| 402 |
+
// Add listener to language toggle button
|
| 403 |
+
if (languageToggle) {
|
| 404 |
+
languageToggle.addEventListener('change', (event) => {
|
| 405 |
+
const newLang = event.target.checked ? 'hi' : 'en';
|
| 406 |
+
applyLanguage(newLang);
|
| 407 |
+
});
|
| 408 |
+
} else {
|
| 409 |
+
console.warn("Language toggle button not found.");
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
</script>
|
| 413 |
+
|
| 414 |
+
<!-- Block for page-specific scripts -->
|
| 415 |
+
|
| 416 |
+
</body>
|
| 417 |
+
</html>
|
examples.html
ADDED
|
@@ -0,0 +1,483 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<!-- Add lang attribute and potentially 'dark' class -->
|
| 3 |
+
<html lang="en" class=""> <!-- Start without 'dark' initially -->
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Prediction Examples - NIC Project</title>
|
| 8 |
+
<!-- Tailwind CSS via CDN -->
|
| 9 |
+
<script src="https://cdn.tailwindcss.com/3.4.1"></script>
|
| 10 |
+
<script>
|
| 11 |
+
// *** Add dark mode strategy to Tailwind config ***
|
| 12 |
+
tailwind.config = {
|
| 13 |
+
darkMode: 'class', // Enable class-based dark mode
|
| 14 |
+
theme: {
|
| 15 |
+
extend: {
|
| 16 |
+
colors: {
|
| 17 |
+
primary: '#1a73e8',
|
| 18 |
+
secondary: '#e8f0fe',
|
| 19 |
+
// Define dark mode colors if needed, or rely on Tailwind's defaults
|
| 20 |
+
// dark: {
|
| 21 |
+
// background: '#1a202c',
|
| 22 |
+
// text: '#e2e8f0',
|
| 23 |
+
// }
|
| 24 |
+
},
|
| 25 |
+
borderRadius: {
|
| 26 |
+
'none': '0px', 'sm': '4px', DEFAULT: '8px', 'md': '12px',
|
| 27 |
+
'lg': '16px', 'xl': '20px', '2xl': '24px', '3xl': '32px',
|
| 28 |
+
'full': '9999px', 'button': '8px'
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
</script>
|
| 34 |
+
<!-- Fonts -->
|
| 35 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 36 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 37 |
+
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
|
| 38 |
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 39 |
+
<!-- Icons -->
|
| 40 |
+
<link href="https://cdn.jsdelivr.net/npm/remixicon@4.2.0/fonts/remixicon.css" rel="stylesheet">
|
| 41 |
+
<!-- Custom Styles -->
|
| 42 |
+
<style>
|
| 43 |
+
/* --- Font Definitions (Ensure loaded via <link> tags in base.html) --- */
|
| 44 |
+
body {
|
| 45 |
+
font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
| 46 |
+
-webkit-font-smoothing: antialiased; /* Smoother fonts */
|
| 47 |
+
-moz-osx-font-smoothing: grayscale;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.hindi-font {
|
| 51 |
+
font-family: 'Noto Sans Devanagari', sans-serif;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/* --- Custom Switch Styles (from provided HTML) --- */
|
| 55 |
+
.custom-switch {
|
| 56 |
+
position: relative;
|
| 57 |
+
display: inline-block;
|
| 58 |
+
width: 50px;
|
| 59 |
+
height: 24px;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.custom-switch-input {
|
| 63 |
+
opacity: 0;
|
| 64 |
+
width: 0;
|
| 65 |
+
height: 0;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.custom-switch-slider {
|
| 69 |
+
position: absolute;
|
| 70 |
+
cursor: pointer;
|
| 71 |
+
top: 0;
|
| 72 |
+
left: 0;
|
| 73 |
+
right: 0;
|
| 74 |
+
bottom: 0;
|
| 75 |
+
background-color: #ccc; /* Default off color */
|
| 76 |
+
transition: .4s;
|
| 77 |
+
border-radius: 34px; /* Rounded */
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.custom-switch-slider:before {
|
| 81 |
+
position: absolute;
|
| 82 |
+
content: "";
|
| 83 |
+
height: 18px;
|
| 84 |
+
width: 18px;
|
| 85 |
+
left: 3px;
|
| 86 |
+
bottom: 3px;
|
| 87 |
+
background-color: white; /* Changed from original rgb(136, 145, 212) to white for consistency with dark mode logic in base.html */
|
| 88 |
+
transition: .4s;
|
| 89 |
+
border-radius: 50%; /* Circle */
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
.custom-switch-input:checked + .custom-switch-slider {
|
| 93 |
+
background-color: #1a73e8; /* Primary color when on */
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.custom-switch-input:checked + .custom-switch-slider:before {
|
| 97 |
+
transform: translateX(26px); /* Move the circle */
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/* --- Accessibility: Ensure focus is visible --- */
|
| 101 |
+
/* Tailwind's default focus rings are usually good, but this is a fallback */
|
| 102 |
+
*:focus-visible {
|
| 103 |
+
outline: 2px solid #1a73e8; /* Use primary color for focus */
|
| 104 |
+
outline-offset: 2px;
|
| 105 |
+
box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.3); /* Optional softer focus ring */
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/* --- Other Minimal Custom Styles (if any) --- */
|
| 109 |
+
|
| 110 |
+
/* Example: Add a specific style for the example image containers if needed beyond grid/aspect ratio */
|
| 111 |
+
.example-image-container {
|
| 112 |
+
/* Custom styles here */
|
| 113 |
+
/* aspect-ratio: 3 / 2; */ /* Tailwind handles aspect ratio now */
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
.example-image {
|
| 117 |
+
/* Custom image styles here */
|
| 118 |
+
}
|
| 119 |
+
/* Add base dark mode styles */
|
| 120 |
+
html.dark body {
|
| 121 |
+
background-color: #1a202c; /* Example dark background */
|
| 122 |
+
color: #e2e8f0; /* Example dark text */
|
| 123 |
+
}
|
| 124 |
+
html.dark header, html.dark footer { /* Adjust header/footer */
|
| 125 |
+
background-color: #2d3748;
|
| 126 |
+
color: #e2e8f0;
|
| 127 |
+
}
|
| 128 |
+
html.dark .card { /* Adjust card styles */
|
| 129 |
+
background-color: #2d3748;
|
| 130 |
+
border-color: #4a5568;
|
| 131 |
+
}
|
| 132 |
+
html.dark h1, html.dark h2, html.dark h3, html.dark h4, html.dark h5, html.dark h6, html.dark p, html.dark span, html.dark li, html.dark label, html.dark small {
|
| 133 |
+
/* Adjust general text elements */
|
| 134 |
+
color: #e2e8f0; /* Light text */
|
| 135 |
+
}
|
| 136 |
+
html.dark .text-gray-600, html.dark .text-gray-700, html.dark .text-gray-800, html.dark .text-gray-900 {
|
| 137 |
+
color: #a0aec0; /* Lighter gray for dark mode */
|
| 138 |
+
}
|
| 139 |
+
html.dark .text-muted {
|
| 140 |
+
color: #718096;
|
| 141 |
+
}
|
| 142 |
+
html.dark .bg-white { background-color: #2d3748 !important; }
|
| 143 |
+
html.dark .bg-gray-50 { background-color: #1a202c !important; }
|
| 144 |
+
html.dark .bg-gray-100 { background-color: #2d3748 !important; }
|
| 145 |
+
html.dark .border-gray-100, html.dark .border-gray-200 { border-color: #4a5568 !important; }
|
| 146 |
+
html.dark .hover\:bg-gray-50:hover { background-color: #4a5568 !important; }
|
| 147 |
+
html.dark .navbar-dark .navbar-brand, html.dark .navbar-dark .nav-link { color: #fff; }
|
| 148 |
+
html.dark .navbar-dark .nav-link.active { color: #fff; font-weight: bold; }
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
</style>
|
| 152 |
+
|
| 153 |
+
<!-- Add specific styles for this page if needed -->
|
| 154 |
+
<style>
|
| 155 |
+
.example-page-img {
|
| 156 |
+
max-height: 150px; /* Adjust height for image display on this page */
|
| 157 |
+
width: auto; /* Maintain aspect ratio */
|
| 158 |
+
object-fit: contain; /* Ensure the whole image is visible */
|
| 159 |
+
margin-left: auto;
|
| 160 |
+
margin-right: auto; /* Center the image within its container */
|
| 161 |
+
}
|
| 162 |
+
.card-title-fixed-height {
|
| 163 |
+
min-height: 3em; /* Adjust as needed to prevent layout jumps */
|
| 164 |
+
display: flex;
|
| 165 |
+
align-items: center;
|
| 166 |
+
justify-content: center;
|
| 167 |
+
}
|
| 168 |
+
</style>
|
| 169 |
+
|
| 170 |
+
</head>
|
| 171 |
+
<!-- Add dark mode background/text for body base -->
|
| 172 |
+
<body class="bg-gray-50 dark:bg-gray-900 min-h-screen flex flex-col text-gray-900 dark:text-gray-200">
|
| 173 |
+
|
| 174 |
+
<!-- Header -->
|
| 175 |
+
<header class="bg-white dark:bg-gray-800 shadow-sm sticky top-0 z-50">
|
| 176 |
+
<div class="container mx-auto px-4 py-3 flex items-center justify-between">
|
| 177 |
+
<div class="flex items-center">
|
| 178 |
+
<!-- Add data-lang attribute -->
|
| 179 |
+
<a href="/" class="text-2xl font-['Pacifico'] text-primary mr-8" data-lang-en="HindiOCR" data-lang-hi="हिन्दी ओसीआर">HindiOCR</a>
|
| 180 |
+
<nav class="hidden md:flex space-x-6">
|
| 181 |
+
<a href="/index.html"
|
| 182 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 183 |
+
data-lang-en="Home" data-lang-hi="होम">Home</a>
|
| 184 |
+
<a href="/recognizer.html"
|
| 185 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 186 |
+
data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a>
|
| 187 |
+
<a href="/examples.html"
|
| 188 |
+
class="hover:text-primary dark:hover:text-blue-400 text-primary dark:text-blue-400 font-medium"
|
| 189 |
+
data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a>
|
| 190 |
+
<a href="/technology.html"
|
| 191 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 192 |
+
data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a>
|
| 193 |
+
<a href="/about.html"
|
| 194 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 195 |
+
data-lang-en="About" data-lang-hi="बारे में">About</a>
|
| 196 |
+
</nav>
|
| 197 |
+
</div>
|
| 198 |
+
<!-- Right side header items -->
|
| 199 |
+
<div class="flex items-center space-x-4">
|
| 200 |
+
<!-- Language Switch -->
|
| 201 |
+
<div class="items-center space-x-2 hidden md:flex">
|
| 202 |
+
<span class="text-sm text-gray-600 dark:text-gray-400">EN</span>
|
| 203 |
+
<label class="custom-switch">
|
| 204 |
+
<!-- *** Add ID: languageToggle *** -->
|
| 205 |
+
<input type="checkbox" id="languageToggle" class="custom-switch-input">
|
| 206 |
+
<span class="custom-switch-slider"></span>
|
| 207 |
+
</label>
|
| 208 |
+
<span class="text-sm text-gray-600 dark:text-gray-400 hindi-font">हिंदी</span>
|
| 209 |
+
</div>
|
| 210 |
+
<!-- Theme Switch -->
|
| 211 |
+
<div class="items-center space-x-2 hidden md:flex">
|
| 212 |
+
<span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-sun-line"></i></span>
|
| 213 |
+
<label class="custom-switch">
|
| 214 |
+
<!-- *** Add ID: themeToggle *** -->
|
| 215 |
+
<input type="checkbox" id="themeToggle" class="custom-switch-input">
|
| 216 |
+
<span class="custom-switch-slider"></span>
|
| 217 |
+
</label>
|
| 218 |
+
<span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-moon-line"></i></span>
|
| 219 |
+
</div>
|
| 220 |
+
<!-- User/Notification Icons (Keep as placeholders) -->
|
| 221 |
+
<div class="w-10 h-10 flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-full cursor-pointer" title="User Profile (Placeholder)">
|
| 222 |
+
<i class="ri-user-line text-gray-600 dark:text-gray-300"></i>
|
| 223 |
+
</div>
|
| 224 |
+
<div class="w-10 h-10 flex items-center justify-center relative cursor-pointer" title="Notifications (Placeholder)">
|
| 225 |
+
<i class="ri-notification-3-line text-gray-600 dark:text-gray-300"></i>
|
| 226 |
+
<span class="absolute top-0 right-0 bg-red-500 text-white text-xs w-5 h-5 flex items-center justify-center rounded-full">3</span>
|
| 227 |
+
</div>
|
| 228 |
+
<!-- Mobile Menu Button (Placeholder) -->
|
| 229 |
+
<button class="md:hidden w-10 h-10 flex items-center justify-center" aria-label="Toggle Menu">
|
| 230 |
+
<i class="ri-menu-line text-gray-600 dark:text-gray-300 text-xl"></i>
|
| 231 |
+
</button>
|
| 232 |
+
</div>
|
| 233 |
+
</div>
|
| 234 |
+
</header>
|
| 235 |
+
|
| 236 |
+
<!-- Main Content Area -->
|
| 237 |
+
<main class="flex-grow">
|
| 238 |
+
|
| 239 |
+
<div class="container mx-auto px-4 py-8">
|
| 240 |
+
<h2 class="text-3xl font-bold text-center text-gray-800 dark:text-white mb-8 border-b border-gray-200 dark:border-gray-700 pb-4">
|
| 241 |
+
<i class="ri-gallery-line mr-2 text-primary align-middle"></i>Example Words & Predictions
|
| 242 |
+
</h2>
|
| 243 |
+
|
| 244 |
+
<!-- Check if there was an error message from Flask -->
|
| 245 |
+
|
| 246 |
+
<!-- Check if examples_data list exists and is not empty -->
|
| 247 |
+
|
| 248 |
+
<p class="text-center text-gray-600 dark:text-gray-400 mb-8">
|
| 249 |
+
Showing results from processing images found in the <code>src/static/examples/</code> directory using the loaded OCR model.
|
| 250 |
+
</p>
|
| 251 |
+
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
|
| 252 |
+
<!-- Loop through each example item passed from Flask - REPLACED WITH STATIC EXAMPLES -->
|
| 253 |
+
|
| 254 |
+
<div class="col">
|
| 255 |
+
<div class="card flex flex-col h-full bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-700 overflow-hidden transition-shadow hover:shadow-lg">
|
| 256 |
+
<!-- Image Section -->
|
| 257 |
+
<div class="bg-gray-50 dark:bg-gray-700 p-4 border-b border-gray-200 dark:border-gray-600 flex justify-center items-center" style="min-height: 180px;"> <!-- Fixed height container -->
|
| 258 |
+
<!-- Placeholder Image - Replace with actual static image paths if available -->
|
| 259 |
+
<img src="/static/examples/sample1.png" class="example-page-img" alt="sample1.png">
|
| 260 |
+
</div>
|
| 261 |
+
<!-- Text Section -->
|
| 262 |
+
<div class="card-body p-4 text-center flex-grow">
|
| 263 |
+
<!-- Prediction Text -->
|
| 264 |
+
<div class="card-title-fixed-height mb-2"> <!-- Fixed height title area -->
|
| 265 |
+
<h5 class="card-title text-2xl hindi-font font-semibold text-gray-800 dark:text-white leading-tight">
|
| 266 |
+
पहला
|
| 267 |
+
</h5>
|
| 268 |
+
</div>
|
| 269 |
+
<!-- Probability -->
|
| 270 |
+
|
| 271 |
+
<p class="card-text text-gray-500 dark:text-gray-400 text-sm mb-0">
|
| 272 |
+
Confidence: 98.5%
|
| 273 |
+
</p>
|
| 274 |
+
|
| 275 |
+
</div>
|
| 276 |
+
<!-- Footer Section -->
|
| 277 |
+
<div class="card-footer bg-gray-50 dark:bg-gray-700 border-t border-gray-200 dark:border-gray-600 px-4 py-2">
|
| 278 |
+
<small class="text-gray-500 dark:text-gray-400 text-xs truncate block">sample1.png</small>
|
| 279 |
+
</div>
|
| 280 |
+
</div>
|
| 281 |
+
</div>
|
| 282 |
+
|
| 283 |
+
<div class="col">
|
| 284 |
+
<div class="card flex flex-col h-full bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-700 overflow-hidden transition-shadow hover:shadow-lg">
|
| 285 |
+
<!-- Image Section -->
|
| 286 |
+
<div class="bg-gray-50 dark:bg-gray-700 p-4 border-b border-gray-200 dark:border-gray-600 flex justify-center items-center" style="min-height: 180px;"> <!-- Fixed height container -->
|
| 287 |
+
<!-- Placeholder Image - Replace with actual static image paths if available -->
|
| 288 |
+
<img src="/static/examples/sample2.png" class="example-page-img" alt="sample2.png">
|
| 289 |
+
</div>
|
| 290 |
+
<!-- Text Section -->
|
| 291 |
+
<div class="card-body p-4 text-center flex-grow">
|
| 292 |
+
<!-- Prediction Text -->
|
| 293 |
+
<div class="card-title-fixed-height mb-2"> <!-- Fixed height title area -->
|
| 294 |
+
<h5 class="card-title text-2xl hindi-font font-semibold text-gray-800 dark:text-white leading-tight">
|
| 295 |
+
नमस्ते
|
| 296 |
+
</h5>
|
| 297 |
+
</div>
|
| 298 |
+
<!-- Probability -->
|
| 299 |
+
|
| 300 |
+
<p class="card-text text-gray-500 dark:text-gray-400 text-sm mb-0">
|
| 301 |
+
Confidence: 95.2%
|
| 302 |
+
</p>
|
| 303 |
+
|
| 304 |
+
</div>
|
| 305 |
+
<!-- Footer Section -->
|
| 306 |
+
<div class="card-footer bg-gray-50 dark:bg-gray-700 border-t border-gray-200 dark:border-gray-600 px-4 py-2">
|
| 307 |
+
<small class="text-gray-500 dark:text-gray-400 text-xs truncate block">sample2.png</small>
|
| 308 |
+
</div>
|
| 309 |
+
</div>
|
| 310 |
+
</div>
|
| 311 |
+
|
| 312 |
+
<div class="col">
|
| 313 |
+
<div class="card flex flex-col h-full bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-700 overflow-hidden transition-shadow hover:shadow-lg">
|
| 314 |
+
<!-- Image Section -->
|
| 315 |
+
<div class="bg-gray-50 dark:bg-gray-700 p-4 border-b border-gray-200 dark:border-gray-600 flex justify-center items-center" style="min-height: 180px;"> <!-- Fixed height container -->
|
| 316 |
+
<!-- Placeholder Image - Replace with actual static image paths if available -->
|
| 317 |
+
<img src="/static/examples/sample3.png" class="example-page-img" alt="sample3.png">
|
| 318 |
+
</div>
|
| 319 |
+
<!-- Text Section -->
|
| 320 |
+
<div class="card-body p-4 text-center flex-grow">
|
| 321 |
+
<!-- Prediction Text -->
|
| 322 |
+
<div class="card-title-fixed-height mb-2"> <!-- Fixed height title area -->
|
| 323 |
+
<h5 class="card-title text-2xl hindi-font font-semibold text-gray-800 dark:text-white leading-tight">
|
| 324 |
+
परियोजना
|
| 325 |
+
</h5>
|
| 326 |
+
</div>
|
| 327 |
+
<!-- Probability -->
|
| 328 |
+
|
| 329 |
+
<p class="card-text text-gray-500 dark:text-gray-400 text-sm mb-0">
|
| 330 |
+
Confidence: 97.8%
|
| 331 |
+
</p>
|
| 332 |
+
|
| 333 |
+
</div>
|
| 334 |
+
<!-- Footer Section -->
|
| 335 |
+
<div class="card-footer bg-gray-50 dark:bg-gray-700 border-t border-gray-200 dark:border-gray-600 px-4 py-2">
|
| 336 |
+
<small class="text-gray-500 dark:text-gray-400 text-xs truncate block">sample3.png</small>
|
| 337 |
+
</div>
|
| 338 |
+
</div>
|
| 339 |
+
</div>
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
</div>
|
| 343 |
+
|
| 344 |
+
<!-- End check for examples_data -->
|
| 345 |
+
|
| 346 |
+
</div> <!-- /container -->
|
| 347 |
+
|
| 348 |
+
</main>
|
| 349 |
+
|
| 350 |
+
<!-- Footer -->
|
| 351 |
+
<footer class="bg-gray-900 text-gray-400 py-12"> <!-- Adjusted footer text color -->
|
| 352 |
+
<div class="container mx-auto px-4">
|
| 353 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
| 354 |
+
<div>
|
| 355 |
+
<!-- Add data-lang attributes to footer elements if needed -->
|
| 356 |
+
<a href="/" class="text-2xl font-['Pacifico'] text-white mb-4 inline-block" data-lang-en="HindiOCR" data-lang-hi="हिन्दी ओसीआर">HindiOCR</a>
|
| 357 |
+
<p class="mb-4 text-sm" data-lang-en="Transforming handwritten Hindi documents into digital text." data-lang-hi="हस्तलिखित हिंदी दस्तावेज़ों को डिजिटल टेक्स्ट में बदलना।">Transforming handwritten Hindi documents into digital text.</p>
|
| 358 |
+
<div class="flex space-x-4">
|
| 359 |
+
<a href="#" class="hover:text-white" title="GitHub (Placeholder)"><i class="ri-github-fill"></i></a>
|
| 360 |
+
<a href="#" class="hover:text-white" title="LinkedIn (Placeholder)"><i class="ri-linkedin-box-fill"></i></a>
|
| 361 |
+
</div>
|
| 362 |
+
</div>
|
| 363 |
+
<div>
|
| 364 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Quick Links" data-lang-hi="त्वरित लिंक्स">Quick Links</h3>
|
| 365 |
+
<ul class="space-y-2 text-sm">
|
| 366 |
+
<li><a href="/" class="hover:text-white" data-lang-en="Home" data-lang-hi="होम">Home</a></li>
|
| 367 |
+
<li><a href="/recognize" class="hover:text-white" data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a></li>
|
| 368 |
+
<li><a href="/examples" class="hover:text-white" data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a></li>
|
| 369 |
+
<li><a href="/technology" class="hover:text-white" data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a></li>
|
| 370 |
+
<li><a href="/about" class="hover:text-white" data-lang-en="About" data-lang-hi="बारे में">About</a></li>
|
| 371 |
+
</ul>
|
| 372 |
+
</div>
|
| 373 |
+
<div>
|
| 374 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Resources" data-lang-hi="संसाधन">Resources</h3>
|
| 375 |
+
<ul class="space-y-2 text-sm">
|
| 376 |
+
<li><a href="#" class="hover:text-white" data-lang-en="Documentation (TBD)" data-lang-hi="प्रलेखन (TBD)">Documentation (TBD)</a></li>
|
| 377 |
+
<li><a href="#" class="hover:text-white" data-lang-en="GitHub Repo (Link)" data-lang-hi="गिटहब रेपो (लिंक)">GitHub Repo (Link)</a></li>
|
| 378 |
+
<li><a href="#" class="hover:text-white" data-lang-en="Support (TBD)" data-lang-hi="समर्थन (TBD)">Support (TBD)</a></li>
|
| 379 |
+
</ul>
|
| 380 |
+
</div>
|
| 381 |
+
<div>
|
| 382 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Contact (Project)" data-lang-hi="संपर्क (परियोजना)">Contact (Project)</h3>
|
| 383 |
+
<ul class="space-y-2 text-sm">
|
| 384 |
+
<li class="flex items-start">
|
| 385 |
+
<i class="ri-mail-line mt-1 mr-2"></i>
|
| 386 |
+
<span>khansamayashaswini@gmail.com</span>
|
| 387 |
+
</li>
|
| 388 |
+
<li class="flex items-center">
|
| 389 |
+
<i class="ri-building-line mr-2"></i>
|
| 390 |
+
<span>MATS University,Raipur / NIC Durg</span>
|
| 391 |
+
</li>
|
| 392 |
+
</ul>
|
| 393 |
+
</div>
|
| 394 |
+
</div>
|
| 395 |
+
<!-- Copyright -->
|
| 396 |
+
<div class="border-t border-gray-700 mt-8 pt-8 text-center">
|
| 397 |
+
<p class="text-sm">© 2025 Yashaswini khansama | Final Year Project | NIC</p>
|
| 398 |
+
</div>
|
| 399 |
+
</div>
|
| 400 |
+
</footer>
|
| 401 |
+
|
| 402 |
+
<!-- Bootstrap JS Bundle (Not needed for Tailwind, can remove if not used elsewhere) -->
|
| 403 |
+
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> -->
|
| 404 |
+
|
| 405 |
+
<!-- Base Theme/Language Script -->
|
| 406 |
+
<script>
|
| 407 |
+
// --- Theme Toggle ---
|
| 408 |
+
const themeToggle = document.getElementById('themeToggle');
|
| 409 |
+
const htmlElement = document.documentElement; // Target <html> tag
|
| 410 |
+
|
| 411 |
+
// Function to apply theme based on preference
|
| 412 |
+
function applyTheme(isDark) {
|
| 413 |
+
if (isDark) {
|
| 414 |
+
htmlElement.classList.add('dark');
|
| 415 |
+
if(themeToggle) themeToggle.checked = true;
|
| 416 |
+
console.log("Theme applied: dark");
|
| 417 |
+
} else {
|
| 418 |
+
htmlElement.classList.remove('dark');
|
| 419 |
+
if(themeToggle) themeToggle.checked = false;
|
| 420 |
+
console.log("Theme applied: light");
|
| 421 |
+
}
|
| 422 |
+
}
|
| 423 |
+
|
| 424 |
+
// Check localStorage on load
|
| 425 |
+
const prefersDark = localStorage.getItem('theme') === 'dark' ||
|
| 426 |
+
(localStorage.getItem('theme') === null && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
| 427 |
+
applyTheme(prefersDark);
|
| 428 |
+
|
| 429 |
+
// Add listener to toggle button
|
| 430 |
+
if(themeToggle){
|
| 431 |
+
themeToggle.addEventListener('change', (event) => {
|
| 432 |
+
const isDark = event.target.checked;
|
| 433 |
+
applyTheme(isDark);
|
| 434 |
+
// Save preference to localStorage
|
| 435 |
+
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
| 436 |
+
});
|
| 437 |
+
} else {
|
| 438 |
+
console.warn("Theme toggle button not found.");
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
// --- Language Toggle (Simple Version) ---
|
| 442 |
+
const languageToggle = document.getElementById('languageToggle');
|
| 443 |
+
const langElements = document.querySelectorAll('[data-lang-en]'); // Select elements with language data
|
| 444 |
+
|
| 445 |
+
// Function to apply language
|
| 446 |
+
function applyLanguage(lang) { // lang should be 'en' or 'hi'
|
| 447 |
+
console.log("Applying language:", lang);
|
| 448 |
+
htmlElement.setAttribute('lang', lang); // Set overall page lang
|
| 449 |
+
|
| 450 |
+
langElements.forEach(el => {
|
| 451 |
+
const text = el.getAttribute(`data-lang-${lang}`);
|
| 452 |
+
if (text) {
|
| 453 |
+
el.textContent = text; // Replace text content
|
| 454 |
+
}
|
| 455 |
+
});
|
| 456 |
+
|
| 457 |
+
// Update toggle state
|
| 458 |
+
if (languageToggle) languageToggle.checked = (lang === 'hi');
|
| 459 |
+
|
| 460 |
+
// Save preference
|
| 461 |
+
localStorage.setItem('language', lang);
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
// Check localStorage on load for language
|
| 465 |
+
const savedLang = localStorage.getItem('language') || 'en'; // Default to English
|
| 466 |
+
applyLanguage(savedLang);
|
| 467 |
+
|
| 468 |
+
// Add listener to language toggle button
|
| 469 |
+
if (languageToggle) {
|
| 470 |
+
languageToggle.addEventListener('change', (event) => {
|
| 471 |
+
const newLang = event.target.checked ? 'hi' : 'en';
|
| 472 |
+
applyLanguage(newLang);
|
| 473 |
+
});
|
| 474 |
+
} else {
|
| 475 |
+
console.warn("Language toggle button not found.");
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
</script>
|
| 479 |
+
|
| 480 |
+
<!-- Block for page-specific scripts -->
|
| 481 |
+
|
| 482 |
+
</body>
|
| 483 |
+
</html>
|
index.html
CHANGED
|
@@ -1,19 +1,620 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!-- this is index.html (Tailwind UI with Auth, OCR, Translation, Gender - Fixed Nav & OCR Prediction - REVISED OCR OUTPUT LAYOUT) -->
|
| 2 |
+
<!DOCTYPE html>
|
| 3 |
+
<html lang="en" class=""> <!-- Start without 'dark' initially -->
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>AI Text Analysis - NIC Project</title>
|
| 8 |
+
<!-- Tailwind CSS via CDN -->
|
| 9 |
+
<script src="https://cdn.tailwindcss.com/3.4.1"></script>
|
| 10 |
+
<script>
|
| 11 |
+
// Tailwind config
|
| 12 |
+
tailwind.config = {
|
| 13 |
+
darkMode: 'class',
|
| 14 |
+
theme: {
|
| 15 |
+
extend: {
|
| 16 |
+
colors: { primary: '#1a73e8', secondary: '#e8f0fe' },
|
| 17 |
+
borderRadius: { 'none': '0px', 'sm': '4px', DEFAULT: '8px', 'md': '12px', 'lg': '16px', 'xl': '20px', '2xl': '24px', '3xl': '32px', 'full': '9999px', 'button': '8px' }
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
}
|
| 21 |
+
</script>
|
| 22 |
+
<!-- Fonts -->
|
| 23 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 24 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 25 |
+
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
|
| 26 |
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 27 |
+
<!-- Icons -->
|
| 28 |
+
<link href="https://cdn.jsdelivr.net/npm/remixicon@4.2.0/fonts/remixicon.css" rel="stylesheet">
|
| 29 |
+
<!-- Custom Styles -->
|
| 30 |
+
<style>
|
| 31 |
+
body { font-family: 'Inter', sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
|
| 32 |
+
.hindi-font { font-family: 'Noto Sans Devanagari', sans-serif; }
|
| 33 |
+
.custom-switch { position: relative; display: inline-block; width: 50px; height: 24px; }
|
| 34 |
+
.custom-switch-input { opacity: 0; width: 0; height: 0; }
|
| 35 |
+
.custom-switch-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
|
| 36 |
+
.custom-switch-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
|
| 37 |
+
.custom-switch-input:checked + .custom-switch-slider { background-color: #1a73e8; }
|
| 38 |
+
.custom-switch-input:checked + .custom-switch-slider:before { transform: translateX(26px); }
|
| 39 |
+
*:focus-visible { outline: 2px solid #1a73e8; outline-offset: 2px; box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.3); }
|
| 40 |
+
/* Base Dark Mode */
|
| 41 |
+
html.dark body { background-color: #1a202c; color: #e2e8f0; }
|
| 42 |
+
html.dark header, html.dark footer { background-color: #2d3748; color: #e2e8f0; }
|
| 43 |
+
html.dark .card, html.dark .auth-card, html.dark .result-card { background-color: #2d3748; border-color: #4a5568; }
|
| 44 |
+
html.dark h1, html.dark h2, html.dark h3, html.dark p, html.dark span, html.dark li, html.dark label, html.dark small, html.dark strong, html.dark button:not(.bg-red-500):not(.bg-green-600), html.dark a { color: #e2e8f0; } /* Adjusted a selector */
|
| 45 |
+
html.dark a.text-primary { color: #60a5fa; } /* Make sure primary links are visible */
|
| 46 |
+
html.dark .text-gray-600, html.dark .text-gray-700, html.dark .text-gray-800, html.dark .text-gray-900 { color: #a0aec0; }
|
| 47 |
+
html.dark .text-gray-500, html.dark .text-gray-400 { color: #718096; }
|
| 48 |
+
html.dark .text-muted { color: #718096; }
|
| 49 |
+
html.dark .bg-white { background-color: #2d3748 !important; }
|
| 50 |
+
html.dark .bg-gray-50 { background-color: #1a202c !important; }
|
| 51 |
+
html.dark .bg-gray-100 { background-color: #374151 !important; }
|
| 52 |
+
html.dark .border-gray-100, html.dark .border-gray-200 { border-color: #4a5568 !important; }
|
| 53 |
+
html.dark .hover\:bg-gray-50:hover { background-color: #4a5568 !important; }
|
| 54 |
+
/* Dark mode Forms */
|
| 55 |
+
html.dark input, html.dark textarea { background-color: #1f2937; border-color: #4b5563; color: #e5e7eb; }
|
| 56 |
+
html.dark input::placeholder, html.dark textarea::placeholder { color: #6b7280; }
|
| 57 |
+
html.dark .auth-link { color: #60a5fa; } html.dark .auth-link:hover { color: #93c5fd; }
|
| 58 |
+
html.dark .error-message { background-color: #450a0a; color: #fecaca; border-color: #7f1d1d; }
|
| 59 |
+
html.dark .spinner { border-color: rgba(255, 255, 255, 0.1); border-left-color: #60a5fa; }
|
| 60 |
+
/* Example Images */
|
| 61 |
+
.example-image-container { cursor: pointer; transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; border: 1px solid transparent; aspect-ratio: 1 / 1; }
|
| 62 |
+
.example-image-container:hover { transform: scale(1.05); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
|
| 63 |
+
.example-image-container.selected { border: 2px solid #1a73e8; box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.3); }
|
| 64 |
+
.example-image { width: 100%; height: 100%; object-fit: contain; }
|
| 65 |
+
html.dark .example-image-container.selected { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3); }
|
| 66 |
+
html.dark .example-image-container { background-color: #4a5568; }
|
| 67 |
+
/* General Loading Spinner */
|
| 68 |
+
.spinner { border: 3px solid rgba(255, 255, 255, 0.3); width: 16px; height: 16px; border-radius: 50%; border-left-color: #fff; animation: spin 1s ease infinite; }
|
| 69 |
+
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
|
| 70 |
+
/* Error Message Styling */
|
| 71 |
+
.error-message { color: #dc2626; background-color: #fee2e2; padding: 0.75rem 1rem; border-radius: 8px; margin-top: 1rem; font-weight: 500; border: 1px solid #fecaca; font-size: 0.9rem; display: none; }
|
| 72 |
+
/* Result Images */
|
| 73 |
+
.result-image { max-width: 100%; height: auto; display: block; margin: 1rem auto 0 auto; border: 1px solid; border-radius: 8px; background-color: #eee; min-height: 100px; } /* Centered result image */
|
| 74 |
+
html.dark .result-image { background-color: #4a5568; border-color: #4a5568;}
|
| 75 |
+
/* Tab Styling */
|
| 76 |
+
.tab-button { transition: all 0.3s ease; border-bottom: 3px solid transparent; }
|
| 77 |
+
.tab-button.active { border-bottom-color: #1a73e8; color: #1a73e8; font-weight: 600; }
|
| 78 |
+
html.dark .tab-button.active { border-bottom-color: #60a5fa; color: #60a5fa; }
|
| 79 |
+
.tab-content { display: none; animation: fadeIn 0.5s ease-in-out; }
|
| 80 |
+
.tab-content.active { display: block; }
|
| 81 |
+
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
|
| 82 |
+
/* Result Styling Refinements */
|
| 83 |
+
.result-card { background-color: #f9fafb; border: 1px solid #e5e7eb; margin-bottom: 1.5rem; padding: 1.5rem; border-radius: 8px; }
|
| 84 |
+
html.dark .result-card { background-color: #374151; border-color: #4b5563; }
|
| 85 |
+
.result-label { font-weight: 600; color: #4b5563; }
|
| 86 |
+
html.dark .result-label { color: #9ca3af; }
|
| 87 |
+
.result-value { font-weight: 500; word-break: break-word; }
|
| 88 |
+
html.dark .result-value { color: #e5e7eb; }
|
| 89 |
+
.result-item { display: grid; grid-template-columns: 1fr; gap: 0.25rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #e5e7eb; }
|
| 90 |
+
html.dark .result-item { border-color: #4b5563; }
|
| 91 |
+
.result-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
|
| 92 |
+
@media (min-width: 768px) { .result-item { grid-template-columns: 150px 1fr; gap: 1rem; align-items: start; } .result-label { text-align: right; } } /* Grid for larger screens */
|
| 93 |
+
/* Loading Indicator general */
|
| 94 |
+
.loading-indicator { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; margin: 1.5rem 0; color: #6b7280; }
|
| 95 |
+
html.dark .loading-indicator { color: #9ca3af; }
|
| 96 |
+
.loading-indicator .spinner { width: 24px; height: 24px; border-width: 3px; }
|
| 97 |
+
|
| 98 |
+
</style>
|
| 99 |
+
</head>
|
| 100 |
+
<body class="bg-gray-50 dark:bg-gray-900 min-h-screen flex flex-col text-gray-900 dark:text-gray-200">
|
| 101 |
+
|
| 102 |
+
<!-- Header -->
|
| 103 |
+
<header class="bg-white dark:bg-gray-800 shadow-sm sticky top-0 z-50">
|
| 104 |
+
<div class="container mx-auto px-4 py-3 flex items-center justify-between">
|
| 105 |
+
<div class="flex items-center">
|
| 106 |
+
<!-- *** Updated Brand Name *** -->
|
| 107 |
+
<a href="/" class="text-2xl font-['Pacifico'] text-primary dark:text-blue-400 mr-8" data-lang-en="AI Text Tools" data-lang-hi="एआई टेक्स्ट उपकरण">AI Text Tools</a>
|
| 108 |
+
<!-- *** RESTORED Navigation Links *** -->
|
| 109 |
+
<nav id="mainNav" class="hidden md:flex space-x-6">
|
| 110 |
+
<a href="index.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300" data-lang-en="Home" data-lang-hi="होम">Home</a>
|
| 111 |
+
<a href="recognizer.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-primary dark:text-blue-400 font-medium" data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a> <!-- Current page? -->
|
| 112 |
+
<a href="examples.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300" data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a> <!-- Link to examples section? -->
|
| 113 |
+
<a href="technology.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300" data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a>
|
| 114 |
+
<a href="about.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300" data-lang-en="About" data-lang-hi="बारे में">About</a>
|
| 115 |
+
</nav>
|
| 116 |
+
</div>
|
| 117 |
+
<!-- Right side header items (Theme, Lang, Logout, etc.) -->
|
| 118 |
+
<div class="flex items-center space-x-4">
|
| 119 |
+
<div class="items-center space-x-2 hidden md:flex"> <span class="text-sm text-gray-600 dark:text-gray-400">EN</span> <label class="custom-switch"><input type="checkbox" id="languageToggle" class="custom-switch-input"><span class="custom-switch-slider"></span></label> <span class="text-sm text-gray-600 dark:text-gray-400 hindi-font">हिंदी</span> </div>
|
| 120 |
+
<div class="items-center space-x-2 hidden md:flex"> <span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-sun-line"></i></span> <label class="custom-switch"><input type="checkbox" id="themeToggle" class="custom-switch-input"><span class="custom-switch-slider"></span></label> <span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-moon-line"></i></span> </div>
|
| 121 |
+
<button id="logoutButton" class="hidden bg-red-500 hover:bg-red-600 text-white px-3 py-1.5 rounded-button text-sm inline-flex items-center gap-1"> <i class="ri-logout-box-r-line"></i> <span data-lang-en="Logout" data-lang-hi="लॉग आउट">Logout</span> </button>
|
| 122 |
+
<div id="userInfoIcons" class="hidden md:flex items-center space-x-4"> <div class="w-10 h-10 flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-full cursor-pointer" title="User Profile (Placeholder)"><i class="ri-user-line text-gray-600 dark:text-gray-300"></i></div> </div>
|
| 123 |
+
<button class="md:hidden w-10 h-10 flex items-center justify-center" aria-label="Toggle Menu"><i class="ri-menu-line text-gray-600 dark:text-gray-300 text-xl"></i></button>
|
| 124 |
+
</div>
|
| 125 |
+
</div>
|
| 126 |
+
</header>
|
| 127 |
+
|
| 128 |
+
<!-- ===== Authentication Container ===== -->
|
| 129 |
+
<div id="authContainer" class="flex-grow flex items-center justify-center p-4">
|
| 130 |
+
<!-- Login/Signup Forms (Keep as is) -->
|
| 131 |
+
<div class="w-full max-w-md"> <form id="loginForm" class="bg-white dark:bg-gray-800 p-8 rounded-lg shadow-md border border-gray-100 dark:border-gray-700 auth-card"> <h2 class="text-2xl font-semibold text-center text-gray-800 dark:text-white mb-6" data-lang-en="Login" data-lang-hi="लॉग इन करें">Login</h2> <div id="loginErrorDiv" class="error-message"></div> <div class="mb-4"> <label for="loginUsername" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1" data-lang-en="Username" data-lang-hi="उपयोगकर्ता नाम">Username</label> <input type="text" id="loginUsername" required autocomplete="username" class="input-field w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white"> </div> <div class="mb-6"> <label for="loginPassword" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1" data-lang-en="Password" data-lang-hi="पासवर्ड">Password</label> <input type="password" id="loginPassword" required autocomplete="current-password" class="input-field w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white"> </div> <button type="submit" id="loginSubmitButton" class="w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-button shadow-sm text-sm font-medium text-white bg-primary hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary dark:focus:ring-offset-gray-800 disabled:opacity-50"> <span data-lang-en="Login" data-lang-hi="लॉग इन करें">Login</span><div class="spinner hidden"></div> </button> <p class="mt-4 text-center text-sm text-gray-600 dark:text-gray-400"> <span data-lang-en="Don't have an account?" data-lang-hi="खाता नहीं है?">Don't have an account?</span> <a href="#" id="showSignupLink" class="font-medium text-primary hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 auth-link" data-lang-en="Sign up" data-lang-hi="साइन अप करें">Sign up</a> </p> </form> <form id="signupForm" class="hidden bg-white dark:bg-gray-800 p-8 rounded-lg shadow-md border border-gray-100 dark:border-gray-700 auth-card"> <h2 class="text-2xl font-semibold text-center text-gray-800 dark:text-white mb-6" data-lang-en="Sign Up" data-lang-hi="साइन अप करें">Sign Up</h2> <div id="signupErrorDiv" class="error-message"></div> <div class="mb-4"><label for="signupUsername" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1" data-lang-en="Username" data-lang-hi="उपयोगकर्ता नाम">Username</label><input type="text" id="signupUsername" required minlength="3" maxlength="50" autocomplete="username" class="input-field w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white"></div> <div class="mb-4"><label for="signupEmail" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1" data-lang-en="Email" data-lang-hi="ईमेल">Email</label><input type="email" id="signupEmail" required autocomplete="email" class="input-field w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white"></div> <div class="mb-6"><label for="signupPassword" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1" data-lang-en="Password (min. 6 chars)" data-lang-hi="पासवर्ड (न्यून. 6 अक्षर)">Password (min. 6 chars)</label><input type="password" id="signupPassword" required minlength="6" autocomplete="new-password" class="input-field w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm dark:bg-gray-700 dark:border-gray-600 dark:text-white"></div> <button type="submit" id="signupSubmitButton" class="w-full flex justify-center items-center gap-2 py-2 px-4 border border-transparent rounded-button shadow-sm text-sm font-medium text-white bg-primary hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary dark:focus:ring-offset-gray-800 disabled:opacity-50"> <span data-lang-en="Sign Up" data-lang-hi="साइन अप करें">Sign Up</span><div class="spinner hidden"></div> </button> <p class="mt-4 text-center text-sm text-gray-600 dark:text-gray-400"> <span data-lang-en="Already have an account?" data-lang-hi="पहले से ही खाता है?">Already have an account?</span> <a href="#" id="showLoginLink" class="font-medium text-primary hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300 auth-link" data-lang-en="Login" data-lang-hi="लॉग इन करें">Login</a> </p> </form> </div>
|
| 132 |
+
</div>
|
| 133 |
+
|
| 134 |
+
<!-- ===== Main Application Container ===== -->
|
| 135 |
+
<main id="appContainer" class="hidden flex-grow container mx-auto px-4 py-8">
|
| 136 |
+
|
| 137 |
+
<!-- Tab Navigation -->
|
| 138 |
+
<div class="mb-6 border-b border-gray-200 dark:border-gray-700">
|
| 139 |
+
<nav class="-mb-px flex space-x-6 overflow-x-auto" aria-label="Tabs"> <!-- Added overflow-x-auto -->
|
| 140 |
+
<button class="tab-button active whitespace-nowrap py-4 px-1 text-sm font-medium flex items-center gap-2" data-tab="ocr"> <i class="ri-image-line text-lg"></i> <span data-lang-en="Hindi OCR" data-lang-hi="हिन्दी ओसीआर">Hindi OCR</span> </button>
|
| 141 |
+
<button class="tab-button whitespace-nowrap py-4 px-1 text-sm font-medium flex items-center gap-2" data-tab="translation"> <i class="ri-translate-2 text-lg"></i> <span data-lang-en="Translation" data-lang-hi="अनुवाद">Translation</span> </button>
|
| 142 |
+
<button class="tab-button whitespace-nowrap py-4 px-1 text-sm font-medium flex items-center gap-2" data-tab="gender"> <i class="ri-men-line text-lg"></i><i class="ri-women-line text-lg -ml-1"></i> <span data-lang-en="Gender Prediction" data-lang-hi="लिंग भविष्यवाणी">Gender Prediction</span> </button>
|
| 143 |
+
</nav>
|
| 144 |
+
</div>
|
| 145 |
+
|
| 146 |
+
<!-- Tab Content Area -->
|
| 147 |
+
<div>
|
| 148 |
+
<!-- OCR Tab Content -->
|
| 149 |
+
<div id="ocrContent" class="tab-content active">
|
| 150 |
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 lg:gap-8">
|
| 151 |
+
<!-- Input Column -->
|
| 152 |
+
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-100 dark:border-gray-700 card">
|
| 153 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white mb-4 border-b border-gray-200 dark:border-gray-600 pb-2 flex items-center gap-2"> <i class="ri-image-add-line text-primary dark:text-blue-400"></i><span data-lang-en="Input Image" data-lang-hi="इनपुट छवि">Input Image</span> </h2>
|
| 154 |
+
<p class="text-gray-600 dark:text-gray-400 text-sm mb-4" data-lang-en="Upload a Hindi word image (PNG, JPG, JPEG) or select an example." data-lang-hi="एक हिन्दी शब्द छवि (PNG, JPG, JPEG) अपलोड करें या उदाहरण चुनें।">Upload a Hindi word image (PNG, JPG, JPEG) or select an example.</p>
|
| 155 |
+
<input type="file" id="imageUpload" accept="image/png, image/jpeg, image/jpg" class="hidden"/>
|
| 156 |
+
<div class="flex items-center mb-4"><label for="imageUpload" class="bg-primary text-white px-4 py-2 rounded-button cursor-pointer hover:bg-blue-700 transition-colors text-sm inline-flex items-center mr-4 whitespace-nowrap gap-2"><i class="ri-upload-2-line"></i><span data-lang-en="Choose File" data-lang-hi="फ़ाइल चुनें">Choose File</span></label><span id="fileName" class="text-gray-500 dark:text-gray-400 text-sm italic truncate" data-lang-en="No file chosen" data-lang-hi="कोई फ़ाइल नहीं चुनी गई">No file chosen</span></div>
|
| 157 |
+
<h3 class="text-md font-semibold text-gray-700 dark:text-gray-300 mb-2" data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</h3>
|
| 158 |
+
<div id="examplesContainer" class="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-3 mb-4"><div class="col-span-full"><span id="examplesLoadingText" class="text-gray-500 dark:text-gray-400 text-sm" data-lang-en="Loading examples..." data-lang-hi="उदाहरण लोड हो रहे हैं...">Loading examples...</span></div></div>
|
| 159 |
+
<div id="imagePreviewContainer" class="mt-4 pt-4 border-t border-gray-200 dark:border-gray-600 hidden"><h3 class="text-md font-semibold text-gray-700 dark:text-gray-300 mb-2 text-center" data-lang-en="Preview" data-lang-hi="पूर्वावलोकन">Preview</h3><div class="flex justify-center items-center bg-gray-50 dark:bg-gray-700 dark:border-gray-600 rounded border p-1 min-h-[100px]"><img id="imagePreview" src="#" alt="Image Preview" class="max-h-60 w-auto rounded"/></div></div>
|
| 160 |
+
<div class="mt-6 pt-4 border-t border-gray-200 dark:border-gray-600 flex gap-4">
|
| 161 |
+
<button id="predictButton" class="flex-1 bg-green-600 text-white px-6 py-3 rounded-button font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed text-lg inline-flex items-center justify-center gap-2" disabled><i class="ri-search-line"></i><span data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</span></button>
|
| 162 |
+
<button id="clearButton" class="flex-none bg-gray-200 hover:bg-gray-300 dark:bg-gray-600 dark:hover:bg-gray-500 text-gray-800 dark:text-gray-200 px-4 py-3 rounded-button text-lg inline-flex items-center justify-center gap-2 hidden"><i class="ri-delete-bin-line"></i><span data-lang-en="Clear" data-lang-hi="साफ़ करें">Clear</span></button>
|
| 163 |
+
</div>
|
| 164 |
+
<div id="errorMessage" class="error-message mt-4"></div>
|
| 165 |
+
</div>
|
| 166 |
+
|
| 167 |
+
<!-- ***** MODIFIED Output Column ***** -->
|
| 168 |
+
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-100 dark:border-gray-700 flex flex-col items-center card">
|
| 169 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white mb-4 border-b border-gray-200 dark:border-gray-600 pb-2 w-full text-center flex items-center justify-center gap-2"><i class="ri-text text-primary dark:text-blue-400"></i><span data-lang-en="Recognition Result" data-lang-hi="पहचान परिणाम">Recognition Result</span></h2>
|
| 170 |
+
<div id="loadingIndicator" class="loading-indicator w-full"><div class="spinner"></div><span id="loadingText" data-lang-en="Processing... Please wait." data-lang-hi="संसाधित हो रहा है... कृपया प्रतीक्षा करें।">Processing...</span></div>
|
| 171 |
+
<div id="resultDisplay" class="mt-4 w-full text-center hidden space-y-6">
|
| 172 |
+
|
| 173 |
+
<!-- *** MOVED Word Detection Section First *** -->
|
| 174 |
+
<div class="result-card !p-4"> <!-- Adjusted padding -->
|
| 175 |
+
<h3 class="text-md font-semibold text-center mb-2" data-lang-en="Word Detection" data-lang-hi="शब्द पहचान">Word Detection</h3>
|
| 176 |
+
<img id="wordDetectionImg" src="#" alt="Word Detection Preview" class="result-image" style="display: none;">
|
| 177 |
+
</div>
|
| 178 |
+
|
| 179 |
+
<!-- *** REMOVED Recognized Text Section *** -->
|
| 180 |
+
<!-- The div containing ocrRecognizedText and wordCountText has been deleted -->
|
| 181 |
+
|
| 182 |
+
<!-- Raw Detector Output Section (Now Second) -->
|
| 183 |
+
<div class="result-card">
|
| 184 |
+
<h3 class="text-md font-semibold mb-2" data-lang-en="Raw Detector Output:" data-lang-hi="रॉ डिटेक्टर आउटपुट:">Raw Detector Output:</h3>
|
| 185 |
+
<pre id="sakshiOutputText" class="text-xs text-left whitespace-pre-wrap break-words max-h-40 overflow-y-auto bg-gray-50 dark:bg-gray-800 p-2 rounded border border-gray-200 dark:border-gray-600"></pre>
|
| 186 |
+
</div>
|
| 187 |
+
|
| 188 |
+
</div>
|
| 189 |
+
<p id="initialMessageOutput" class="text-gray-500 dark:text-gray-400 mt-6 text-center" data-lang-en="Results will appear here." data-lang-hi="परिणाम यहां दिखाई देंगे।">Results will appear here.</p>
|
| 190 |
+
</div>
|
| 191 |
+
<!-- ***** End of MODIFIED Output Column ***** -->
|
| 192 |
+
|
| 193 |
+
</div>
|
| 194 |
+
</div>
|
| 195 |
+
|
| 196 |
+
<!-- Translation Tab Content -->
|
| 197 |
+
<div id="translationContent" class="tab-content">
|
| 198 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 lg:gap-8">
|
| 199 |
+
<!-- Translation Input -->
|
| 200 |
+
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-100 dark:border-gray-700 card">
|
| 201 |
+
<h2 class="text-xl font-semibold mb-4 border-b pb-2 flex items-center gap-2"><i class="ri-translate-2 text-primary dark:text-blue-400"></i><span data-lang-en="Translate Text" data-lang-hi="पाठ का अनुवाद करें">Translate Text</span></h2>
|
| 202 |
+
<div class="mb-4">
|
| 203 |
+
<label for="textToTranslate" class="block text-sm font-medium mb-1" data-lang-en="Text to Translate:" data-lang-hi="अनुवाद के लिए पाठ:">Text to Translate:</label>
|
| 204 |
+
<textarea id="textToTranslate" rows="5" placeholder="Enter text here or use OCR output..." class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm dark:bg-gray-700 dark:border-gray-600"></textarea>
|
| 205 |
+
</div>
|
| 206 |
+
<div class="mb-4">
|
| 207 |
+
<label for="sourceLanguage" class="block text-sm font-medium mb-1" data-lang-en="Source Language (Optional):" data-lang-hi="स्रोत भाषा (वैकल्पिक):">Source Language (Optional):</label>
|
| 208 |
+
<input type="text" id="sourceLanguage" placeholder="Leave empty for auto-detection" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm dark:bg-gray-700 dark:border-gray-600">
|
| 209 |
+
</div>
|
| 210 |
+
<div class="mb-4">
|
| 211 |
+
<label for="targetLanguage" class="block text-sm font-medium mb-1" data-lang-en="Target Language:" data-lang-hi="लक्ष्य भाषा:">Target Language:</label>
|
| 212 |
+
<input type="text" id="targetLanguage" placeholder="e.g., English, Hindi, French" required class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm dark:bg-gray-700 dark:border-gray-600">
|
| 213 |
+
<p class="text-xs text-gray-500 dark:text-gray-400 mt-1" data-lang-en="Enter target language name (e.g., English)." data-lang-hi="लक्ष्य भाषा का नाम दर्ज करें (उदा., English)।">Enter target language name (e.g., English).</p>
|
| 214 |
+
</div>
|
| 215 |
+
<button id="translateButton" class="w-full bg-primary text-white px-4 py-2 rounded-button hover:bg-blue-700 transition-colors inline-flex items-center justify-center gap-2">
|
| 216 |
+
<i class="ri-translate"></i><span data-lang-en="Translate" data-lang-hi="अनुवाद करें">Translate</span>
|
| 217 |
+
</button>
|
| 218 |
+
<div id="translationError" class="error-message mt-4"></div>
|
| 219 |
+
</div>
|
| 220 |
+
<!-- Translation Output -->
|
| 221 |
+
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-100 dark:border-gray-700 card">
|
| 222 |
+
<h2 class="text-xl font-semibold mb-4 border-b pb-2 flex items-center gap-2"><i class="ri-chat-check-line text-primary dark:text-blue-400"></i><span data-lang-en="Translation Result" data-lang-hi="अनुवाद परिणाम">Translation Result</span></h2>
|
| 223 |
+
<div id="translationLoading" class="loading-indicator"><div class="spinner"></div><span data-lang-en="Translating..." data-lang-hi="अनुवाद हो रहा है...">Translating...</span></div>
|
| 224 |
+
<div id="translationResultDisplay" class="hidden space-y-4">
|
| 225 |
+
<div class="result-item !border-none !pb-0"> <div class="result-label" data-lang-en="Source Language:" data-lang-hi="स्रोत भाषा:">Source Language:</div> <div id="detectedSourceLanguage" class="result-value font-medium"></div> </div>
|
| 226 |
+
<div class="result-item !border-none !pb-0"> <div class="result-label" data-lang-en="Target Language:" data-lang-hi="लक्ष्य भाषा:">Target Language:</div> <div id="translationTargetLanguage" class="result-value font-medium"></div> </div>
|
| 227 |
+
<div class="mt-2"> <div class="result-label mb-1" data-lang-en="Translated Text:" data-lang-hi="अनुवादित पाठ:">Translated Text:</div> <div id="translatedText" class="result-value p-3 bg-gray-100 dark:bg-gray-700 rounded border border-gray-200 dark:border-gray-600 min-h-[100px] whitespace-pre-wrap"></div> </div>
|
| 228 |
+
</div>
|
| 229 |
+
<p id="initialMessageTranslation" class="text-gray-500 dark:text-gray-400 mt-6 text-center" data-lang-en="Enter text and languages, then click Translate." data-lang-hi="पाठ और भाषाएँ दर्ज करें, फिर अनुवाद करें पर क्लिक करें।">Enter text and languages, then click Translate.</p>
|
| 230 |
+
</div>
|
| 231 |
+
</div>
|
| 232 |
+
</div>
|
| 233 |
+
|
| 234 |
+
<!-- Gender Prediction Tab Content -->
|
| 235 |
+
<div id="genderContent" class="tab-content">
|
| 236 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 lg:gap-8">
|
| 237 |
+
<!-- Gender Input -->
|
| 238 |
+
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-100 dark:border-gray-700 card">
|
| 239 |
+
<h2 class="text-xl font-semibold mb-4 border-b pb-2 flex items-center gap-2"><i class="ri-user-search-line text-primary dark:text-blue-400"></i><span data-lang-en="Predict Gender from Names" data-lang-hi="नामों से लिंग की भविष्यवाणी करें">Predict Gender from Names</span></h2>
|
| 240 |
+
<div class="mb-4">
|
| 241 |
+
<label for="namesInput" class="block text-sm font-medium mb-1" data-lang-en="Enter Names (comma-separated):" data-lang-hi="नाम दर्ज करें (अल्पविराम से अलग):">Enter Names (comma-separated):</label>
|
| 242 |
+
<textarea id="namesInput" rows="5" placeholder="e.g., Priya, Rahul, Alex, Sam" class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-primary focus:border-primary sm:text-sm dark:bg-gray-700 dark:border-gray-600"></textarea>
|
| 243 |
+
</div>
|
| 244 |
+
<button id="predictGenderButton" class="w-full bg-primary text-white px-4 py-2 rounded-button hover:bg-blue-700 transition-colors inline-flex items-center justify-center gap-2">
|
| 245 |
+
<i class="ri-men-line"></i><i class="ri-women-line -ml-1"></i><span data-lang-en="Predict Gender" data-lang-hi="लिंग की भविष्यवाणी करें">Predict Gender</span>
|
| 246 |
+
</button>
|
| 247 |
+
<div id="genderError" class="error-message mt-4"></div>
|
| 248 |
+
</div>
|
| 249 |
+
<!-- Gender Output -->
|
| 250 |
+
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-100 dark:border-gray-700 card">
|
| 251 |
+
<h2 class="text-xl font-semibold mb-4 border-b pb-2 flex items-center gap-2"><i class="ri-bar-chart-2-line text-primary dark:text-blue-400"></i><span data-lang-en="Prediction Results" data-lang-hi="भविष्यवाणी परिणाम">Prediction Results</span></h2>
|
| 252 |
+
<div id="genderLoading" class="loading-indicator"><div class="spinner"></div><span data-lang-en="Analyzing..." data-lang-hi="विश्लेषण हो रहा है...">Analyzing...</span></div>
|
| 253 |
+
<div id="genderResultDisplay" class="hidden space-y-4"> <!-- Results populated here --> </div>
|
| 254 |
+
<p id="initialMessageGender" class="text-gray-500 dark:text-gray-400 mt-6 text-center" data-lang-en="Enter names and click Predict." data-lang-hi="नाम दर्ज करें और भविष्यवाणी पर क्लिक करें।">Enter names and click Predict.</p>
|
| 255 |
+
</div>
|
| 256 |
+
</div>
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
|
| 260 |
+
</main>
|
| 261 |
+
|
| 262 |
+
<!-- Footer -->
|
| 263 |
+
<footer class="bg-gray-900 text-gray-400 py-12 mt-12">
|
| 264 |
+
<!-- Footer content (Keep as is) -->
|
| 265 |
+
<div class="container mx-auto px-4"> <div class="grid grid-cols-1 md:grid-cols-4 gap-8"> <div><a href="/" class="text-2xl font-['Pacifico'] text-white mb-4 inline-block" data-lang-en="AI Text Tools" data-lang-hi="एआई टेक्स्ट उपकरण">AI Text Tools</a><p class="mb-4 text-sm" data-lang-en="AI-powered tools for text analysis and processing." data-lang-hi="पाठ विश्लेषण और प्रसंस्करण के लिए एआई-संचालित उपकरण।">AI-powered tools for text analysis.</p><div class="flex space-x-4"><a href="#" class="hover:text-white" title="GitHub (Placeholder)"><i class="ri-github-fill"></i></a><a href="#" class="hover:text-white" title="LinkedIn (Placeholder)"><i class="ri-linkedin-box-fill"></i></a></div></div> <div><h3 class="text-lg font-medium text-white mb-4" data-lang-en="Quick Links" data-lang-hi="त्वरित लिंक्स">Quick Links</h3><ul class="space-y-2 text-sm"><li><a href="#" class="hover:text-white" data-lang-en="Home" data-lang-hi="होम">Home</a></li><li><a href="#" class="hover:text-white" data-lang-en="Tools" data-lang-hi="उपकरण">Tools</a></li><li><a href="#" class="hover:text-white" data-lang-en="About" data-lang-hi="बारे में">About</a></li></ul></div> <div><h3 class="text-lg font-medium text-white mb-4" data-lang-en="Resources" data-lang-hi="संसाधन">Resources</h3><ul class="space-y-2 text-sm"><li><a href="#" class="hover:text-white" data-lang-en="API Docs (TBD)" data-lang-hi="एपीआई डॉक्स (TBD)">API Docs (TBD)</a></li><li><a href="#" class="hover:text-white" data-lang-en="GitHub Repo" data-lang-hi="गिटहब रेपो">GitHub Repo</a></li></ul></div> <div><h3 class="text-lg font-medium text-white mb-4" data-lang-en="Contact" data-lang-hi="संपर्क">Contact</h3><ul class="space-y-2 text-sm"><li class="flex items-start"><i class="ri-mail-line mt-1 mr-2"></i><span>your-email@example.com</span></li></ul></div> </div> <div class="border-t border-gray-700 mt-8 pt-8 text-center"><p class="text-sm">© 2025 Slimshadow.org | AI Text Tools Project</p></div> </div>
|
| 266 |
+
</footer>
|
| 267 |
+
|
| 268 |
+
<!-- Base Theme/Language Script -->
|
| 269 |
+
<script>
|
| 270 |
+
// Theme Toggle (Keep as is)
|
| 271 |
+
const themeToggle = document.getElementById('themeToggle'); const htmlElement = document.documentElement; function applyTheme(isDark) { if (isDark) { htmlElement.classList.add('dark'); if(themeToggle) themeToggle.checked = true; } else { htmlElement.classList.remove('dark'); if(themeToggle) themeToggle.checked = false; } } const prefersDark = localStorage.getItem('theme') === 'dark' || (localStorage.getItem('theme') === null && window.matchMedia('(prefers-color-scheme: dark)').matches); applyTheme(prefersDark); if(themeToggle){ themeToggle.addEventListener('change', (event) => { const isDark = event.target.checked; applyTheme(isDark); localStorage.setItem('theme', isDark ? 'dark' : 'light'); }); } else { console.warn("Theme toggle button not found."); }
|
| 272 |
+
// Language Toggle (Keep as is)
|
| 273 |
+
const languageToggle = document.getElementById('languageToggle'); const langElements = document.querySelectorAll('[data-lang-en]'); function applyLanguage(lang) { htmlElement.setAttribute('lang', lang); langElements.forEach(el => { const text = el.getAttribute(`data-lang-${lang}`); if (text) { const icon = el.querySelector('i'); if (icon && el.childNodes.length > 1) { let updated = false; el.childNodes.forEach(node => { if (node.nodeType === Node.TEXT_NODE && node.textContent.trim() !== '') { node.textContent = ` ${text} `; updated = true; } }); if (!updated) { const currentText = el.getAttribute(`data-lang-${lang === 'en' ? 'hi' : 'en'}`); if(currentText) el.innerHTML = el.innerHTML.replace(currentText, text);}} else { el.textContent = text; } } }); if (languageToggle) languageToggle.checked = (lang === 'hi'); localStorage.setItem('language', lang); } const savedLang = localStorage.getItem('language') || 'en'; if (languageToggle) { languageToggle.addEventListener('change', (event) => { const newLang = event.target.checked ? 'hi' : 'en'; applyLanguage(newLang); }); } else { console.warn("Language toggle button not found."); }
|
| 274 |
+
</script>
|
| 275 |
+
|
| 276 |
+
<!-- ***** Page Interaction & Full App Script (MODIFIED) ***** -->
|
| 277 |
+
<script>
|
| 278 |
+
// --- API Configuration ---
|
| 279 |
+
const OCR_API_BASE_URL = 'https://sameernotes-ocr.hf.space';
|
| 280 |
+
const TRANSLATION_API_BASE_URL = 'https://sameernotes-translation-prediction-space.hf.space';
|
| 281 |
+
const GENDER_API_BASE_URL = "https://sidvilas-gender-prediction-space.hf.space";
|
| 282 |
+
const TOKEN_ENDPOINT = `${OCR_API_BASE_URL}/token`;
|
| 283 |
+
const SIGNUP_ENDPOINT = `${OCR_API_BASE_URL}/signup`;
|
| 284 |
+
const PROCESS_ENDPOINT = `${OCR_API_BASE_URL}/process/`;
|
| 285 |
+
const WORD_DETECT_ENDPOINT = `${OCR_API_BASE_URL}/word-detection/`;
|
| 286 |
+
// const PREDICTION_IMG_ENDPOINT = `${OCR_API_BASE_URL}/prediction/`; // Removed
|
| 287 |
+
const TRANSLATE_ENDPOINT = `${TRANSLATION_API_BASE_URL}/translate`;
|
| 288 |
+
const GENDER_PREDICT_ENDPOINT = `${GENDER_API_BASE_URL}/predict`;
|
| 289 |
+
const TOKEN_STORAGE_KEY = 'aiTextToolsAuthToken';
|
| 290 |
+
|
| 291 |
+
// --- State Variables ---
|
| 292 |
+
let accessToken = localStorage.getItem(TOKEN_STORAGE_KEY);
|
| 293 |
+
let currentImageSource = null;
|
| 294 |
+
let currentExampleSelection = null;
|
| 295 |
+
|
| 296 |
+
// --- DOM Elements ---
|
| 297 |
+
// Auth & Core App
|
| 298 |
+
const authContainer = document.getElementById('authContainer');
|
| 299 |
+
const appContainer = document.getElementById('appContainer');
|
| 300 |
+
const loginForm = document.getElementById('loginForm');
|
| 301 |
+
const signupForm = document.getElementById('signupForm');
|
| 302 |
+
const loginUsernameInput = document.getElementById('loginUsername');
|
| 303 |
+
const loginPasswordInput = document.getElementById('loginPassword');
|
| 304 |
+
const loginErrorDiv = document.getElementById('loginErrorDiv');
|
| 305 |
+
const loginSubmitButton = document.getElementById('loginSubmitButton');
|
| 306 |
+
const signupUsernameInput = document.getElementById('signupUsername');
|
| 307 |
+
const signupEmailInput = document.getElementById('signupEmail');
|
| 308 |
+
const signupPasswordInput = document.getElementById('signupPassword');
|
| 309 |
+
const signupErrorDiv = document.getElementById('signupErrorDiv');
|
| 310 |
+
const signupSubmitButton = document.getElementById('signupSubmitButton');
|
| 311 |
+
const showSignupLink = document.getElementById('showSignupLink');
|
| 312 |
+
const showLoginLink = document.getElementById('showLoginLink');
|
| 313 |
+
const logoutButton = document.getElementById('logoutButton');
|
| 314 |
+
const mainNav = document.getElementById('mainNav');
|
| 315 |
+
const userInfoIcons = document.getElementById('userInfoIcons');
|
| 316 |
+
// Tabs
|
| 317 |
+
const tabButtons = document.querySelectorAll('.tab-button');
|
| 318 |
+
const tabContents = document.querySelectorAll('.tab-content');
|
| 319 |
+
// OCR Input
|
| 320 |
+
const imageUpload = document.getElementById('imageUpload');
|
| 321 |
+
const fileNameSpan = document.getElementById('fileName');
|
| 322 |
+
const examplesContainer = document.getElementById('examplesContainer');
|
| 323 |
+
const examplesLoadingText = document.getElementById('examplesLoadingText');
|
| 324 |
+
const imagePreviewContainer = document.getElementById('imagePreviewContainer');
|
| 325 |
+
const imagePreview = document.getElementById('imagePreview');
|
| 326 |
+
const predictButton = document.getElementById('predictButton');
|
| 327 |
+
const clearButton = document.getElementById('clearButton');
|
| 328 |
+
const errorMessage = document.getElementById('errorMessage');
|
| 329 |
+
// OCR Output
|
| 330 |
+
const loadingIndicator = document.getElementById('loadingIndicator');
|
| 331 |
+
const loadingText = document.getElementById('loadingText');
|
| 332 |
+
const resultDisplay = document.getElementById('resultDisplay');
|
| 333 |
+
// const ocrRecognizedText = document.getElementById('ocrRecognizedText'); // *** REMOVED ***
|
| 334 |
+
// const wordCountText = document.getElementById('wordCountText'); // *** REMOVED ***
|
| 335 |
+
const sakshiOutputText = document.getElementById('sakshiOutputText');
|
| 336 |
+
const wordDetectionImg = document.getElementById('wordDetectionImg');
|
| 337 |
+
// const predictionImg = document.getElementById('predictionImg'); // Removed
|
| 338 |
+
const initialMessageOutput = document.getElementById('initialMessageOutput');
|
| 339 |
+
// Translation
|
| 340 |
+
const textToTranslateInput = document.getElementById('textToTranslate');
|
| 341 |
+
const sourceLanguageInput = document.getElementById('sourceLanguage');
|
| 342 |
+
const targetLanguageInput = document.getElementById('targetLanguage');
|
| 343 |
+
const translateButton = document.getElementById('translateButton');
|
| 344 |
+
const translationLoading = document.getElementById('translationLoading');
|
| 345 |
+
const translationResultDisplay = document.getElementById('translationResultDisplay');
|
| 346 |
+
const detectedSourceLanguage = document.getElementById('detectedSourceLanguage');
|
| 347 |
+
const translationTargetLanguage = document.getElementById('translationTargetLanguage');
|
| 348 |
+
const translatedText = document.getElementById('translatedText');
|
| 349 |
+
const translationError = document.getElementById('translationError');
|
| 350 |
+
const initialMessageTranslation = document.getElementById('initialMessageTranslation');
|
| 351 |
+
// Gender Prediction
|
| 352 |
+
const namesInput = document.getElementById('namesInput');
|
| 353 |
+
const predictGenderButton = document.getElementById('predictGenderButton');
|
| 354 |
+
const genderLoading = document.getElementById('genderLoading');
|
| 355 |
+
const genderResultDisplay = document.getElementById('genderResultDisplay');
|
| 356 |
+
const genderError = document.getElementById('genderError');
|
| 357 |
+
const initialMessageGender = document.getElementById('initialMessageGender');
|
| 358 |
+
|
| 359 |
+
// --- Example Images ---
|
| 360 |
+
const exampleImages = [ /* ... (keep list as before) ... */ { name: "नमस्ते", url: "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Hindi_Word_Namaste.svg/1280px-Hindi_Word_Namaste.svg.png" }, { name: "भारत", url: "https://upload.wikimedia.org/wikipedia/commons/thumb/1/11/Devanagari_stroke_order_for_%E0%A4%AD%E0%A4%BE%E0%A4%B0%E0%A4%A4.svg/1200px-Devanagari_stroke_order_for_%E0%A4%AD%E0%A4%BE%E0%A4%B0%E0%A4%A4.svg.png" }, { name: "धन्यवाद", url: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f4/Devanagari_stroke_order_for_%E0%A4%A7%E0%A4%A8%E0%A5%8D%E0%A4%AF%E0%A4%B5%E0%A4%BE%E0%A4%A6.svg/1200px-Devanagari_stroke_order_for_%E0%A4%A7%E0%A4%A8%E0%A5%8D%E0%A4%AF%E0%A4%B5%E0%A4%BE%E0%A4%A6.svg.png" }, { name: "हॉस्टल", url: "https://raw.githubusercontent.com/sameer-banchhor-git/data-sakshi/main/%E0%A4%B9%E0%A5%89%E0%A4%B8%E0%A5%8D%E0%A4%A4%E0%A4%B2.png" }, { name: "स्वास्थ्य", url: "https://raw.githubusercontent.com/sameer-banchhor-git/data-sakshi/main/%E0%A4%B8%E0%A5%8D%E0%A4%B5%E0%A4%BE%E0%A4%B8%E0%A5%8D%E0%A4%A5%E0%A5%8D%E0%A4%AF.png" }, { name: "हुई", url: "https://raw.githubusercontent.com/sameer-banchhor-git/data-sakshi/main/%E0%A4%B9%E0%A5%81%E0%A4%88.png" }, { name: "दिनांक", url: "https://raw.githubusercontent.com/sameer-banchhor-git/data-sakshi/main/%E0%A4%A6%E0%A4%BF%E0%A4%A8%E0%A4%BE%E0%A4%82%E0%A4%95.png"}, { name: "कार्यालय", url: "https://raw.githubusercontent.com/sameer-banchhor-git/data-sakshi/main/%E0%A4%95%E0%A4%BE%E0%A4%B0%E0%A5%8D%E0%A4%AF%E0%A4%BE%E0%A4%B2%E0%A4%AF.png"} ];
|
| 361 |
+
|
| 362 |
+
// --- Helper Functions (Auth UI, Error, Loading) ---
|
| 363 |
+
// ... (Keep showAuthScreen, showAppScreen, displayError, hideError, showAuthLoading, showLoadingIndicator, showOcrLoading functions exactly as in the previous version) ...
|
| 364 |
+
function showAuthScreen() { console.log("Showing Auth Screen"); accessToken = null; localStorage.removeItem(TOKEN_STORAGE_KEY); if (authContainer) authContainer.classList.remove('hidden'); if (appContainer) appContainer.classList.add('hidden'); if (mainNav) mainNav.classList.add('hidden'); if (userInfoIcons) userInfoIcons.classList.add('hidden'); if (logoutButton) logoutButton.classList.add('hidden'); hideError(loginErrorDiv); hideError(signupErrorDiv); if(loginForm) loginForm.classList.remove('hidden'); if(signupForm) signupForm.classList.add('hidden'); if(loginUsernameInput) loginUsernameInput.value = ''; if(loginPasswordInput) loginPasswordInput.value = ''; }
|
| 365 |
+
function showAppScreen() { console.log("Showing App Screen"); if (!accessToken) { showAuthScreen(); return; } if (authContainer) authContainer.classList.add('hidden'); if (appContainer) appContainer.classList.remove('hidden'); if (mainNav) mainNav.classList.remove('hidden', 'md:flex'); if (mainNav) mainNav.classList.add('md:flex'); if (userInfoIcons) userInfoIcons.classList.remove('hidden', 'md:flex'); if (userInfoIcons) userInfoIcons.classList.add('md:flex'); if (logoutButton) logoutButton.classList.remove('hidden'); loadExamples(); activateTab('ocr'); }
|
| 366 |
+
function displayError(element, message) { if (element) { element.textContent = message; element.classList.remove('hidden'); console.warn("Error:", message); } else { console.error("Element missing for error:", message); } }
|
| 367 |
+
function hideError(element) { if (element) { element.classList.add('hidden'); element.textContent = ''; } }
|
| 368 |
+
function showAuthLoading(formType, isLoading) { const button = formType === 'login' ? loginSubmitButton : signupSubmitButton; if (!button) return; const spinner = button.querySelector('.spinner'); button.disabled = isLoading; if (spinner) spinner.classList.toggle('hidden', !isLoading); }
|
| 369 |
+
function showLoadingIndicator(element, show = true) { if (element) { element.style.display = show ? 'flex' : 'none'; } }
|
| 370 |
+
function showOcrLoading(isLoading, message = "Processing...") { if (loadingIndicator) { loadingIndicator.classList.toggle('hidden', !isLoading); if (loadingText) loadingText.textContent = message; } if (predictButton) predictButton.disabled = isLoading; if (clearButton) clearButton.disabled = isLoading; }
|
| 371 |
+
|
| 372 |
+
|
| 373 |
+
// --- Generic Authenticated Fetch ---
|
| 374 |
+
// ... (Keep authenticatedFetch function exactly as in the previous correct version) ...
|
| 375 |
+
async function authenticatedFetch(url, options = {}) { if (!accessToken) { showAuthScreen(); throw new Error("Not authenticated."); } const defaultOptions = { headers: { 'Authorization': `Bearer ${accessToken}`, 'Accept': 'application/json', ...options.headers }, }; if (options.body && !(options.body instanceof FormData) && !(options.body instanceof URLSearchParams) && !defaultOptions.headers['Content-Type']) { defaultOptions.headers['Content-Type'] = 'application/json'; } const finalOptions = { ...options, ...defaultOptions }; /* console.log("Auth Fetch:", url); */ try { const response = await fetch(url, finalOptions); /* console.log(`Status ${url}:`, response.status); */ if (!response.ok) { let errorData = { detail: `Request failed: ${response.status}` }; let bodyText = ''; try { bodyText = await response.text(); errorData = JSON.parse(bodyText); if (!errorData.detail) errorData.detail = bodyText; } catch (e) { errorData.detail = bodyText || errorData.detail; } console.error(`API Error ${url}:`, response.status, errorData.detail); if (response.status === 401) { showAuthScreen(); throw new Error("Auth failed/expired."); } throw new Error(typeof errorData.detail === 'string' ? errorData.detail : JSON.stringify(errorData.detail)); } const contentType = response.headers.get("content-type"); if (response.status === 204) return null; if (contentType?.includes("application/json")) return await response.json(); if (contentType?.includes("image/") || contentType?.includes("application/octet-stream")) return await response.blob(); return await response.text(); } catch (error) { console.error(`Fetch Catch ${url}:`, error); throw error; } }
|
| 376 |
+
|
| 377 |
+
// --- LOGIN / SIGNUP / LOGOUT ---
|
| 378 |
+
// ... (Keep handleLogin, handleSignup, handleLogout functions exactly as in the previous correct version) ...
|
| 379 |
+
if (loginForm) { loginForm.addEventListener('submit', async (event) => { event.preventDefault(); const username = loginUsernameInput.value.trim(); const password = loginPasswordInput.value.trim(); hideError(loginErrorDiv); if (!username || !password) { displayError(loginErrorDiv, "Username & Password required."); return; } const body = new URLSearchParams(); body.append('username', username); body.append('password', password); showAuthLoading('login', true); try { const response = await fetch(TOKEN_ENDPOINT, { method: 'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json'}, body: body }); const data = await response.json().catch(() => null); if (!response.ok) { throw new Error(data?.detail || `Login failed (${response.status})`); } if (data?.access_token) { accessToken = data.access_token; localStorage.setItem(TOKEN_STORAGE_KEY, accessToken); console.log("Login success."); showAppScreen(); } else { throw new Error('No access token received.'); } } catch (error) { let msg = error.message || "Unknown login error."; if (msg.includes("Incorrect")) msg = "Incorrect username or password."; if (error instanceof TypeError) msg = "Network error."; displayError(loginErrorDiv, msg); } finally { showAuthLoading('login', false); } }); }
|
| 380 |
+
if (signupForm) { signupForm.addEventListener('submit', async (event) => { event.preventDefault(); const username = signupUsernameInput.value.trim(); const email = signupEmailInput.value.trim(); const password = signupPasswordInput.value.trim(); hideError(signupErrorDiv); if (!username || !email || !password) { displayError(signupErrorDiv, "Please fill all fields."); return; } if (password.length < 6) { displayError(signupErrorDiv, "Password must be >= 6 characters."); return; } if (!/\S+@\S+\.\S+/.test(email)) { displayError(signupErrorDiv, "Invalid email format."); return; } showAuthLoading('signup', true); try { const response = await fetch(SIGNUP_ENDPOINT, { method: 'POST', headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}, body: JSON.stringify({ username, email, password }) }); const data = await response.json().catch(() => null); if (!response.ok) { throw new Error(data?.detail || `Signup failed (${response.status})`); } console.log("Signup successful:", data); alert('Signup successful! Please login.'); if(signupForm) signupForm.classList.add('hidden'); if(loginForm) loginForm.classList.remove('hidden'); signupUsernameInput.value = ''; signupEmailInput.value = ''; signupPasswordInput.value = ''; } catch (error) { let msg = error.message || "Unknown signup error."; if (error instanceof TypeError) msg = "Network error."; displayError(signupErrorDiv, msg); } finally { showAuthLoading('signup', false); } }); }
|
| 381 |
+
if(logoutButton) logoutButton.addEventListener('click', () => { showAuthScreen(); clearOCRState(); clearTranslationState(); clearGenderState(); });
|
| 382 |
+
if (showSignupLink) showSignupLink.addEventListener('click', (e) => { e.preventDefault(); if(loginForm) loginForm.classList.add('hidden'); if(signupForm) signupForm.classList.remove('hidden'); hideError(loginErrorDiv); hideError(signupErrorDiv); });
|
| 383 |
+
if (showLoginLink) showLoginLink.addEventListener('click', (e) => { e.preventDefault(); if(signupForm) signupForm.classList.add('hidden'); if(loginForm) loginForm.classList.remove('hidden'); hideError(loginErrorDiv); hideError(signupErrorDiv); });
|
| 384 |
+
|
| 385 |
+
|
| 386 |
+
// --- TAB MANAGEMENT ---
|
| 387 |
+
function activateTab(tabId) { /* ... (Keep implementation) ... */ tabButtons.forEach(b => { b.classList.toggle('active', b.dataset.tab === tabId); }); tabContents.forEach(c => { c.classList.toggle('active', c.id === `${tabId}Content`); }); console.log("Activated tab:", tabId); }
|
| 388 |
+
tabButtons.forEach(button => { button.addEventListener('click', () => activateTab(button.dataset.tab)); });
|
| 389 |
+
|
| 390 |
+
// --- OCR Functionality ---
|
| 391 |
+
function loadExamples() { /* ... (Keep implementation) ... */ if (!examplesContainer || !appContainer || appContainer.classList.contains('hidden')) return; if (examplesLoadingText) examplesContainer.innerHTML = ''; const examplesToShow = exampleImages.slice(0, 12); examplesToShow.forEach((imgData, index) => { const div = document.createElement('div'); div.className = 'example-image-container bg-gray-100 dark:bg-gray-700 rounded-md overflow-hidden border border-gray-200 dark:border-gray-600'; div.setAttribute('role', 'button'); div.setAttribute('tabindex', '0'); div.setAttribute('aria-label', `Example ${index + 1}: ${imgData.name}`); div.dataset.imageUrl = imgData.url; div.dataset.imageName = imgData.name; const img = document.createElement('img'); img.src = imgData.url; img.alt = `Example ${index + 1}: ${imgData.name}`; img.className = 'example-image'; img.loading = 'lazy'; img.onerror = () => { div.innerHTML = `<span class="text-xs text-red-500 p-1">Load Error</span>`; }; div.appendChild(img); div.addEventListener('click', () => handleExampleClick(div, imgData.url, imgData.name)); div.addEventListener('keydown', (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); handleExampleClick(div, imgData.url, imgData.name); } }); examplesContainer.appendChild(div); }); }
|
| 392 |
+
async function handleExampleClick(element, imageUrl, imageName) { /* ... (Keep implementation) ... */ if (currentExampleSelection) { currentExampleSelection.classList.remove('selected'); } element.classList.add('selected'); currentExampleSelection = element; if (imageUpload) imageUpload.value = null; displayFileName(`Example: ${imageName}`); resetResultState(); hideError(errorMessage); try { showPreview(imageUrl); showOcrLoading(true, "Fetching..."); const response = await fetch(imageUrl); if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`); const blob = await response.blob(); const fileName = imageUrl.substring(imageUrl.lastIndexOf('/') + 1)?.split('?')[0] || `${imageName.replace(/\s+/g, '_')}.png`; currentImageSource = new File([blob], fileName, { type: blob.type || 'image/png' }); enableProcessButtons(); } catch (error) { console.error("Error fetching example:", error); displayError(errorMessage, `Could not load example: ${error.message}`); disableProcessButtons(); currentImageSource = null; hidePreview(); } finally { showOcrLoading(false); } }
|
| 393 |
+
function handleFileSelect() { /* ... (Keep implementation) ... */ const file = imageUpload.files[0]; if (!file) return; const allowed = ['image/png', 'image/jpeg', 'image/jpg']; if (!allowed.includes(file.type)) { displayError(errorMessage, 'Invalid file type.'); clearOCRState(); return; } currentImageSource = file; displayFileName(file.name); resetResultState(); hideError(errorMessage); if (currentExampleSelection) { currentExampleSelection.classList.remove('selected'); currentExampleSelection = null; } showPreview(file); enableProcessButtons(); }
|
| 394 |
+
function displayFileName(name) { /* ... (Keep implementation) ... */ if (fileNameSpan) { fileNameSpan.textContent = name; fileNameSpan.classList.remove('italic', 'text-gray-500', 'dark:text-gray-400'); fileNameSpan.classList.add('font-medium'); } }
|
| 395 |
+
function resetFileName() { /* ... (Keep implementation) ... */ if (fileNameSpan) { const defaultEn = "No file chosen"; const defaultHi = "कोई फ़ाइल नहीं चुनी गई"; const currentLang = document.documentElement.lang || 'en'; fileNameSpan.textContent = currentLang === 'hi' ? defaultHi : defaultEn; fileNameSpan.classList.add('italic', 'text-gray-500', 'dark:text-gray-400'); fileNameSpan.classList.remove('font-medium'); } }
|
| 396 |
+
function showPreview(source) { /* ... (Keep implementation) ... */ if (!imagePreview || !imagePreviewContainer) return; imagePreview.src = ''; imagePreviewContainer.classList.remove('hidden'); if (typeof source === 'string') { imagePreview.src = source; } else if (source instanceof File) { const reader = new FileReader(); reader.onload = (e) => { imagePreview.src = e.target.result; }; reader.onerror = () => displayError(errorMessage, "Could not read file."); reader.readAsDataURL(source); } }
|
| 397 |
+
function hidePreview() { /* ... (Keep implementation) ... */ if (imagePreview && imagePreviewContainer) { imagePreview.src = '#'; imagePreviewContainer.classList.add('hidden'); } }
|
| 398 |
+
function enableProcessButtons() { /* ... (Keep implementation) ... */ if (predictButton) predictButton.disabled = false; if (clearButton) clearButton.classList.remove('hidden'); }
|
| 399 |
+
function disableProcessButtons() { /* ... (Keep implementation) ... */ if (predictButton) predictButton.disabled = true; if (clearButton) clearButton.classList.add('hidden'); }
|
| 400 |
+
|
| 401 |
+
function resetResultState() { /* *** MODIFIED *** */
|
| 402 |
+
if (resultDisplay) resultDisplay.classList.add('hidden');
|
| 403 |
+
if (initialMessageOutput) initialMessageOutput.classList.remove('hidden');
|
| 404 |
+
// *** REMOVED lines for ocrRecognizedText and wordCountText ***
|
| 405 |
+
if (sakshiOutputText) sakshiOutputText.textContent = '';
|
| 406 |
+
if (wordDetectionImg) { wordDetectionImg.src = '#'; wordDetectionImg.style.display = 'none'; }
|
| 407 |
+
hideError(errorMessage);
|
| 408 |
+
}
|
| 409 |
+
|
| 410 |
+
function clearOCRState() { /* *** MODIFIED (only removed reference to predictionImg reset which was already removed) *** */
|
| 411 |
+
if (imageUpload) imageUpload.value = ''; currentImageSource = null; if (currentExampleSelection) { currentExampleSelection.classList.remove('selected'); currentExampleSelection = null; } hidePreview(); resetFileName(); disableProcessButtons(); resetResultState(); hideError(errorMessage); showOcrLoading(false); console.log("OCR State Cleared");
|
| 412 |
+
}
|
| 413 |
+
|
| 414 |
+
if (imageUpload) imageUpload.addEventListener('change', handleFileSelect);
|
| 415 |
+
if (predictButton) predictButton.addEventListener('click', processImage);
|
| 416 |
+
if (clearButton) clearButton.addEventListener('click', clearOCRState);
|
| 417 |
+
|
| 418 |
+
async function processImage() { /* *** MODIFIED *** */
|
| 419 |
+
if (!currentImageSource) { displayError(errorMessage, 'Please choose/select an image.'); return; } hideError(errorMessage); resetResultState(); showOcrLoading(true, "Preparing...");
|
| 420 |
+
try {
|
| 421 |
+
const formData = new FormData(); if (currentImageSource instanceof File) { formData.append('file', currentImageSource); } else if (typeof currentImageSource === 'string') { showOcrLoading(true, "Fetching sample..."); const response = await fetch(currentImageSource); if (!response.ok) throw new Error(`Fetch failed: ${response.statusText}`); const blob = await response.blob(); const filename = currentImageSource.split('/').pop()?.split('?')[0] || 'sample.png'; formData.append('file', new File([blob], filename, { type: blob.type || 'image/png' })); } else { throw new Error("Invalid image source."); }
|
| 422 |
+
showOcrLoading(true, "Processing OCR...");
|
| 423 |
+
const data = await authenticatedFetch(PROCESS_ENDPOINT, { method: 'POST', body: formData });
|
| 424 |
+
console.log("OCR Response:", data);
|
| 425 |
+
|
| 426 |
+
// *** REMOVED lines for ocrRecognizedText and wordCountText ***
|
| 427 |
+
|
| 428 |
+
// *** KEPT these lines ***
|
| 429 |
+
if(sakshiOutputText) sakshiOutputText.textContent = data.sakshi_output || 'No raw output.';
|
| 430 |
+
if(textToTranslateInput) textToTranslateInput.value = data.prediction_label || ''; // Use prediction_label for translate input
|
| 431 |
+
|
| 432 |
+
// *** Only fetch Word Detection Image ***
|
| 433 |
+
const fetchWordDetectImage = async () => {
|
| 434 |
+
wordDetectionImg.style.display = 'none';
|
| 435 |
+
wordDetectionImg.src = '#';
|
| 436 |
+
try {
|
| 437 |
+
showOcrLoading(true, `Fetching Word Detection...`);
|
| 438 |
+
const blob = await authenticatedFetch(WORD_DETECT_ENDPOINT);
|
| 439 |
+
if (blob instanceof Blob) {
|
| 440 |
+
const imageUrl = URL.createObjectURL(blob);
|
| 441 |
+
wordDetectionImg.onload = () => URL.revokeObjectURL(imageUrl);
|
| 442 |
+
wordDetectionImg.onerror = () => console.error(`Failed to load Word Detection from blob URL`);
|
| 443 |
+
wordDetectionImg.src = imageUrl;
|
| 444 |
+
wordDetectionImg.alt = "Word Detection Preview";
|
| 445 |
+
wordDetectionImg.style.display = 'block';
|
| 446 |
+
} else {
|
| 447 |
+
console.warn(`Failed blob fetch for Word Detection`);
|
| 448 |
+
}
|
| 449 |
+
} catch (imgError) {
|
| 450 |
+
console.error(`Error fetching Word Detection image:`, imgError);
|
| 451 |
+
}
|
| 452 |
+
};
|
| 453 |
+
|
| 454 |
+
await fetchWordDetectImage(); // Await only the word detection image
|
| 455 |
+
|
| 456 |
+
if(resultDisplay) resultDisplay.classList.remove('hidden');
|
| 457 |
+
if(initialMessageOutput) initialMessageOutput.classList.add('hidden');
|
| 458 |
+
} catch (error) {
|
| 459 |
+
console.error('Error processing image:', error);
|
| 460 |
+
displayError(errorMessage, `Processing Error: ${error.message}`);
|
| 461 |
+
resetResultState(); // Ensure results are cleared on error
|
| 462 |
+
} finally {
|
| 463 |
+
showOcrLoading(false);
|
| 464 |
+
}
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
// --- TRANSLATION Functionality (Updated for Gemini Backend) ---
|
| 468 |
+
function clearTranslationState() {
|
| 469 |
+
if(textToTranslateInput) textToTranslateInput.value = '';
|
| 470 |
+
if(sourceLanguageInput) sourceLanguageInput.value = '';
|
| 471 |
+
if(targetLanguageInput) targetLanguageInput.value = '';
|
| 472 |
+
if(translationResultDisplay) translationResultDisplay.classList.add('hidden');
|
| 473 |
+
if(initialMessageTranslation) initialMessageTranslation.classList.remove('hidden');
|
| 474 |
+
// No 'detectedSourceLanguage' element to clear anymore
|
| 475 |
+
if(translationTargetLanguage) translationTargetLanguage.textContent = '';
|
| 476 |
+
if(translatedText) translatedText.innerHTML = ''; // Clear innerHTML
|
| 477 |
+
hideError(translationError);
|
| 478 |
+
showLoadingIndicator(translationLoading, false);
|
| 479 |
+
console.log("Translation Cleared");
|
| 480 |
+
// Ensure source language row is hidden on clear
|
| 481 |
+
const sourceLangItem = document.getElementById('detectedSourceLanguage')?.closest('.result-item');
|
| 482 |
+
if (sourceLangItem) {
|
| 483 |
+
sourceLangItem.style.display = 'none';
|
| 484 |
+
}
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
if(translateButton) {
|
| 488 |
+
translateButton.addEventListener('click', async () => {
|
| 489 |
+
const text = textToTranslateInput.value.trim();
|
| 490 |
+
const sourceLang = sourceLanguageInput.value.trim();
|
| 491 |
+
const targetLang = targetLanguageInput.value.trim();
|
| 492 |
+
|
| 493 |
+
hideError(translationError);
|
| 494 |
+
showLoadingIndicator(translationLoading, true);
|
| 495 |
+
if(translationResultDisplay) translationResultDisplay.classList.add('hidden');
|
| 496 |
+
if(initialMessageTranslation) initialMessageTranslation.classList.remove('hidden'); // Show initial message while loading/error
|
| 497 |
+
|
| 498 |
+
if (!text) {
|
| 499 |
+
displayError(translationError, 'Please enter text to translate.');
|
| 500 |
+
showLoadingIndicator(translationLoading, false);
|
| 501 |
+
return;
|
| 502 |
+
}
|
| 503 |
+
if (!targetLang) {
|
| 504 |
+
displayError(translationError, 'Please enter the target language (e.g., English, Hindi).');
|
| 505 |
+
showLoadingIndicator(translationLoading, false);
|
| 506 |
+
return;
|
| 507 |
+
}
|
| 508 |
+
|
| 509 |
+
console.log(`Attempting translation from '${sourceLang || 'auto-detect'}' to '${targetLang}'. Text:`, text.substring(0, 50) + "...");
|
| 510 |
+
|
| 511 |
+
const payload = {
|
| 512 |
+
text: text,
|
| 513 |
+
target_language: targetLang
|
| 514 |
+
};
|
| 515 |
+
// Only include source_language if the user provided it
|
| 516 |
+
if (sourceLang) {
|
| 517 |
+
payload.source_language = sourceLang;
|
| 518 |
+
}
|
| 519 |
+
console.log("Translation API Request Payload:", payload);
|
| 520 |
+
|
| 521 |
+
try {
|
| 522 |
+
// Use standard fetch, NOT authenticatedFetch, as this endpoint doesn't require the OCR token
|
| 523 |
+
const response = await fetch(TRANSLATE_ENDPOINT, {
|
| 524 |
+
method: 'POST',
|
| 525 |
+
headers: {
|
| 526 |
+
'Content-Type': 'application/json',
|
| 527 |
+
'Accept': 'text/html' // Indicate preference for HTML response
|
| 528 |
+
},
|
| 529 |
+
body: JSON.stringify(payload)
|
| 530 |
+
});
|
| 531 |
+
|
| 532 |
+
// Check if the request was successful (status code 2xx)
|
| 533 |
+
if (!response.ok) {
|
| 534 |
+
let errorDetail = `Request failed with status: ${response.status}`;
|
| 535 |
+
try {
|
| 536 |
+
// Try to parse FastAPI's JSON error response
|
| 537 |
+
const errorJson = await response.json();
|
| 538 |
+
errorDetail = errorJson.detail || JSON.stringify(errorJson);
|
| 539 |
+
} catch (e) {
|
| 540 |
+
// If parsing JSON fails, try to get plain text error
|
| 541 |
+
try {
|
| 542 |
+
errorDetail = await response.text();
|
| 543 |
+
} catch (textErr) {
|
| 544 |
+
// Keep the original status code message if text fails too
|
| 545 |
+
}
|
| 546 |
+
}
|
| 547 |
+
// Throw an error with the extracted detail
|
| 548 |
+
throw new Error(errorDetail);
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
// Get the response body as HTML text
|
| 552 |
+
const translatedHtml = await response.text();
|
| 553 |
+
console.log("Translation API Raw HTML Response:", translatedHtml);
|
| 554 |
+
|
| 555 |
+
// --- Update UI ---
|
| 556 |
+
// Display the target language requested by the user
|
| 557 |
+
if(translationTargetLanguage) translationTargetLanguage.textContent = targetLang;
|
| 558 |
+
// Set the innerHTML of the result element to render the HTML tags
|
| 559 |
+
if(translatedText) translatedText.innerHTML = translatedHtml;
|
| 560 |
+
|
| 561 |
+
// Remove the section displaying detected source language as it's not returned
|
| 562 |
+
const sourceLangItem = document.getElementById('detectedSourceLanguage')?.closest('.result-item');
|
| 563 |
+
if (sourceLangItem) {
|
| 564 |
+
sourceLangItem.style.display = 'none'; // Hide the source language display row
|
| 565 |
+
}
|
| 566 |
+
|
| 567 |
+
|
| 568 |
+
if(translationResultDisplay) translationResultDisplay.classList.remove('hidden');
|
| 569 |
+
if(initialMessageTranslation) initialMessageTranslation.classList.add('hidden'); // Hide initial message on success
|
| 570 |
+
|
| 571 |
+
} catch (error) {
|
| 572 |
+
console.error('Error during translation fetch/processing:', error);
|
| 573 |
+
let userMessage = `Translation Error: ${error.message}`; // Default message
|
| 574 |
+
|
| 575 |
+
// Provide more specific feedback if possible
|
| 576 |
+
if (error.message.includes("supported")) {
|
| 577 |
+
userMessage = `Translation Error: The target language '${targetLang}' might not be supported by the backend.`;
|
| 578 |
+
} else if (error.message.includes("Failed to fetch")) {
|
| 579 |
+
userMessage = "Translation Error: Network error or CORS issue. Could not reach the translation server. Check console logs.";
|
| 580 |
+
} else if (error.message.startsWith("Request failed with status:")) {
|
| 581 |
+
userMessage = `Translation Error: Server responded with an error (${error.message})`; // Show status code error
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
displayError(translationError, userMessage);
|
| 585 |
+
if(initialMessageTranslation) initialMessageTranslation.classList.remove('hidden'); // Ensure initial message placeholder is visible on error
|
| 586 |
+
} finally {
|
| 587 |
+
showLoadingIndicator(translationLoading, false);
|
| 588 |
+
}
|
| 589 |
+
});
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
// --- GENDER PREDICTION Functionality ---
|
| 593 |
+
function clearGenderState() { /* ... (Keep implementation) ... */ if(namesInput) namesInput.value = ''; if(genderResultDisplay) genderResultDisplay.innerHTML = ''; if(genderResultDisplay) genderResultDisplay.classList.add('hidden'); if(initialMessageGender) initialMessageGender.classList.remove('hidden'); hideError(genderError); showLoadingIndicator(genderLoading, false); console.log("Gender Cleared"); }
|
| 594 |
+
function displayGenderResults(data) { /* ... (Keep implementation) ... */ if (!genderResultDisplay) return; genderResultDisplay.innerHTML = ''; if (!data || !data.predictions || data.predictions.length === 0) { genderResultDisplay.innerHTML = "<p class='text-center text-gray-500 dark:text-gray-400'>No prediction results.</p>"; return; } let resultsHTML = ''; data.predictions.forEach(p => { const maleProb = (p.male_probability !== null && p.male_probability !== undefined) ? p.male_probability.toFixed(2) : 'N/A'; const confidence = (p.confidence !== null && p.confidence !== undefined) ? p.confidence.toFixed(2) : 'N/A'; resultsHTML += `<div class="result-item"><div class="result-label">Name:</div><div class="result-value">${p.name || 'N/A'}</div><div class="result-label">Predicted:</div><div class="result-value">${p.predicted_gender || 'N/A'}</div><div class="result-label">Male Prob:</div><div class="result-value">${maleProb}</div><div class="result-label">Confidence:</div><div class="result-value">${confidence}</div></div>`; }); genderResultDisplay.innerHTML = resultsHTML; genderResultDisplay.classList.remove('hidden'); if(initialMessageGender) initialMessageGender.classList.add('hidden'); }
|
| 595 |
+
if(predictGenderButton) {
|
| 596 |
+
predictGenderButton.addEventListener('click', async () => { /* ... (Keep implementation) ... */
|
| 597 |
+
const namesString = namesInput.value.trim(); const names = namesString.split(',').map(name => name.trim()).filter(Boolean); hideError(genderError); showLoadingIndicator(genderLoading, true); if(genderResultDisplay) genderResultDisplay.classList.add('hidden'); if(initialMessageGender) initialMessageGender.classList.remove('hidden'); if (names.length === 0) { displayError(genderError, "Please enter names."); showLoadingIndicator(genderLoading, false); return; }
|
| 598 |
+
try { const data = await authenticatedFetch(GENDER_PREDICT_ENDPOINT, { method: 'POST', body: JSON.stringify({ names: names, threshold: 0.5 }) }); console.log("Gender Response:", data); displayGenderResults(data); } catch (error) { console.error("Gender Prediction error:", error); displayError(genderError, `Prediction Error: ${error.message}`); } finally { showLoadingIndicator(genderLoading, false); }
|
| 599 |
+
});
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
// --- Initialization ---
|
| 603 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 604 |
+
console.log("DOM Loaded. Initializing...");
|
| 605 |
+
accessToken = localStorage.getItem(TOKEN_STORAGE_KEY);
|
| 606 |
+
if (accessToken) { showAppScreen(); } else { showAuthScreen(); }
|
| 607 |
+
resetFileName(); applyLanguage(savedLang);
|
| 608 |
+
clearOCRState(); clearTranslationState(); clearGenderState();
|
| 609 |
+
activateTab('ocr'); // Ensure OCR tab is active first
|
| 610 |
+
// Ensure source language row is hidden initially
|
| 611 |
+
const sourceLangItem = document.getElementById('detectedSourceLanguage')?.closest('.result-item');
|
| 612 |
+
if (sourceLangItem) {
|
| 613 |
+
sourceLangItem.style.display = 'none';
|
| 614 |
+
}
|
| 615 |
+
});
|
| 616 |
+
|
| 617 |
+
</script>
|
| 618 |
+
|
| 619 |
+
</body>
|
| 620 |
+
</html>
|
recognizer.html
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
!DOCTYPE html>
|
| 2 |
+
<!-- Add lang attribute and potentially 'dark' class -->
|
| 3 |
+
<html lang="en" class=""> <!-- Start without 'dark' initially -->
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Recognize Word - NIC Project</title>
|
| 8 |
+
<!-- Tailwind CSS via CDN -->
|
| 9 |
+
<script src="https://cdn.tailwindcss.com/3.4.1"></script>
|
| 10 |
+
<script>
|
| 11 |
+
// *** Add dark mode strategy to Tailwind config ***
|
| 12 |
+
tailwind.config = {
|
| 13 |
+
darkMode: 'class', // Enable class-based dark mode
|
| 14 |
+
theme: {
|
| 15 |
+
extend: {
|
| 16 |
+
colors: {
|
| 17 |
+
primary: '#1a73e8',
|
| 18 |
+
secondary: '#e8f0fe',
|
| 19 |
+
// Define dark mode colors if needed, or rely on Tailwind's defaults
|
| 20 |
+
// dark: {
|
| 21 |
+
// background: '#1a202c',
|
| 22 |
+
// text: '#e2e8f0',
|
| 23 |
+
// }
|
| 24 |
+
},
|
| 25 |
+
borderRadius: {
|
| 26 |
+
'none': '0px', 'sm': '4px', DEFAULT: '8px', 'md': '12px',
|
| 27 |
+
'lg': '16px', 'xl': '20px', '2xl': '24px', '3xl': '32px',
|
| 28 |
+
'full': '9999px', 'button': '8px'
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
</script>
|
| 34 |
+
<!-- Fonts -->
|
| 35 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 36 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 37 |
+
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
|
| 38 |
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 39 |
+
<!-- Icons -->
|
| 40 |
+
<link href="https://cdn.jsdelivr.net/npm/remixicon@4.2.0/fonts/remixicon.css" rel="stylesheet">
|
| 41 |
+
<!-- Custom Styles -->
|
| 42 |
+
<style>
|
| 43 |
+
/* --- Font Definitions (Ensure loaded via <link> tags in base.html) --- */
|
| 44 |
+
body {
|
| 45 |
+
font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
| 46 |
+
-webkit-font-smoothing: antialiased; /* Smoother fonts */
|
| 47 |
+
-moz-osx-font-smoothing: grayscale;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.hindi-font {
|
| 51 |
+
font-family: 'Noto Sans Devanagari', sans-serif;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/* --- Custom Switch Styles (from provided HTML) --- */
|
| 55 |
+
.custom-switch {
|
| 56 |
+
position: relative;
|
| 57 |
+
display: inline-block;
|
| 58 |
+
width: 50px;
|
| 59 |
+
height: 24px;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.custom-switch-input {
|
| 63 |
+
opacity: 0;
|
| 64 |
+
width: 0;
|
| 65 |
+
height: 0;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.custom-switch-slider {
|
| 69 |
+
position: absolute;
|
| 70 |
+
cursor: pointer;
|
| 71 |
+
top: 0;
|
| 72 |
+
left: 0;
|
| 73 |
+
right: 0;
|
| 74 |
+
bottom: 0;
|
| 75 |
+
background-color: #ccc; /* Default off color */
|
| 76 |
+
transition: .4s;
|
| 77 |
+
border-radius: 34px; /* Rounded */
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.custom-switch-slider:before {
|
| 81 |
+
position: absolute;
|
| 82 |
+
content: "";
|
| 83 |
+
height: 18px;
|
| 84 |
+
width: 18px;
|
| 85 |
+
left: 3px;
|
| 86 |
+
bottom: 3px;
|
| 87 |
+
background-color: white; /* Changed from original rgb(136, 145, 212) to white for consistency with dark mode logic in base.html */
|
| 88 |
+
transition: .4s;
|
| 89 |
+
border-radius: 50%; /* Circle */
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
.custom-switch-input:checked + .custom-switch-slider {
|
| 93 |
+
background-color: #1a73e8; /* Primary color when on */
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.custom-switch-input:checked + .custom-switch-slider:before {
|
| 97 |
+
transform: translateX(26px); /* Move the circle */
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/* --- Accessibility: Ensure focus is visible --- */
|
| 101 |
+
/* Tailwind's default focus rings are usually good, but this is a fallback */
|
| 102 |
+
*:focus-visible {
|
| 103 |
+
outline: 2px solid #1a73e8; /* Use primary color for focus */
|
| 104 |
+
outline-offset: 2px;
|
| 105 |
+
box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.3); /* Optional softer focus ring */
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/* --- Other Minimal Custom Styles (if any) --- */
|
| 109 |
+
|
| 110 |
+
/* Example: Add a specific style for the example image containers if needed beyond grid/aspect ratio */
|
| 111 |
+
.example-image-container {
|
| 112 |
+
/* Custom styles here */
|
| 113 |
+
/* aspect-ratio: 3 / 2; */ /* Tailwind handles aspect ratio now */
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
.example-image {
|
| 117 |
+
/* Custom image styles here */
|
| 118 |
+
}
|
| 119 |
+
/* Add base dark mode styles */
|
| 120 |
+
html.dark body {
|
| 121 |
+
background-color: #1a202c; /* Example dark background */
|
| 122 |
+
color: #e2e8f0; /* Example dark text */
|
| 123 |
+
}
|
| 124 |
+
html.dark header, html.dark footer { /* Adjust header/footer */
|
| 125 |
+
background-color: #2d3748;
|
| 126 |
+
color: #e2e8f0;
|
| 127 |
+
}
|
| 128 |
+
html.dark .card { /* Adjust card styles */
|
| 129 |
+
background-color: #2d3748;
|
| 130 |
+
border-color: #4a5568;
|
| 131 |
+
}
|
| 132 |
+
html.dark h1, html.dark h2, html.dark h3, html.dark h4, html.dark h5, html.dark h6, html.dark p, html.dark span, html.dark li, html.dark label, html.dark small {
|
| 133 |
+
/* Adjust general text elements */
|
| 134 |
+
color: #e2e8f0; /* Light text */
|
| 135 |
+
}
|
| 136 |
+
html.dark .text-gray-600, html.dark .text-gray-700, html.dark .text-gray-800, html.dark .text-gray-900 {
|
| 137 |
+
color: #a0aec0; /* Lighter gray for dark mode */
|
| 138 |
+
}
|
| 139 |
+
html.dark .text-muted {
|
| 140 |
+
color: #718096;
|
| 141 |
+
}
|
| 142 |
+
html.dark .bg-white { background-color: #2d3748 !important; }
|
| 143 |
+
html.dark .bg-gray-50 { background-color: #1a202c !important; }
|
| 144 |
+
html.dark .bg-gray-100 { background-color: #2d3748 !important; }
|
| 145 |
+
html.dark .border-gray-100, html.dark .border-gray-200 { border-color: #4a5568 !important; }
|
| 146 |
+
html.dark .hover\:bg-gray-50:hover { background-color: #4a5568 !important; }
|
| 147 |
+
html.dark .navbar-dark .navbar-brand, html.dark .navbar-dark .nav-link { color: #fff; }
|
| 148 |
+
html.dark .navbar-dark .nav-link.active { color: #fff; font-weight: bold; }
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
</style>
|
| 152 |
+
|
| 153 |
+
</head>
|
| 154 |
+
<!-- Add dark mode background/text for body base -->
|
| 155 |
+
<body class="bg-gray-50 dark:bg-gray-900 min-h-screen flex flex-col text-gray-900 dark:text-gray-200">
|
| 156 |
+
|
| 157 |
+
<!-- Header -->
|
| 158 |
+
<header class="bg-white dark:bg-gray-800 shadow-sm sticky top-0 z-50">
|
| 159 |
+
<div class="container mx-auto px-4 py-3 flex items-center justify-between">
|
| 160 |
+
<div class="flex items-center">
|
| 161 |
+
<!-- Add data-lang attribute -->
|
| 162 |
+
<a href="/" class="text-2xl font-['Pacifico'] text-primary mr-8" data-lang-en="HindiOCR" data-lang-hi="हिन्दी ओसीआर">HindiOCR</a>
|
| 163 |
+
<nav class="hidden md:flex space-x-6">
|
| 164 |
+
<a href="/index.html"
|
| 165 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 166 |
+
data-lang-en="Home" data-lang-hi="होम">Home</a>
|
| 167 |
+
<a href="/recognizer.html"
|
| 168 |
+
class="hover:text-primary dark:hover:text-blue-400 text-primary dark:text-blue-400 font-medium"
|
| 169 |
+
data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a>
|
| 170 |
+
<a href="/examples.html"
|
| 171 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 172 |
+
data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a>
|
| 173 |
+
<a href="/technology.html"
|
| 174 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 175 |
+
data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a>
|
| 176 |
+
<a href="/about.html"
|
| 177 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 178 |
+
data-lang-en="About" data-lang-hi="बारे में">About</a>
|
| 179 |
+
</nav>
|
| 180 |
+
</div>
|
| 181 |
+
<!-- Right side header items -->
|
| 182 |
+
<div class="flex items-center space-x-4">
|
| 183 |
+
<!-- Language Switch -->
|
| 184 |
+
<div class="items-center space-x-2 hidden md:flex">
|
| 185 |
+
<span class="text-sm text-gray-600 dark:text-gray-400">EN</span>
|
| 186 |
+
<label class="custom-switch">
|
| 187 |
+
<!-- *** Add ID: languageToggle *** -->
|
| 188 |
+
<input type="checkbox" id="languageToggle" class="custom-switch-input">
|
| 189 |
+
<span class="custom-switch-slider"></span>
|
| 190 |
+
</label>
|
| 191 |
+
<span class="text-sm text-gray-600 dark:text-gray-400 hindi-font">हिंदी</span>
|
| 192 |
+
</div>
|
| 193 |
+
<!-- Theme Switch -->
|
| 194 |
+
<div class="items-center space-x-2 hidden md:flex">
|
| 195 |
+
<span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-sun-line"></i></span>
|
| 196 |
+
<label class="custom-switch">
|
| 197 |
+
<!-- *** Add ID: themeToggle *** -->
|
| 198 |
+
<input type="checkbox" id="themeToggle" class="custom-switch-input">
|
| 199 |
+
<span class="custom-switch-slider"></span>
|
| 200 |
+
</label>
|
| 201 |
+
<span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-moon-line"></i></span>
|
| 202 |
+
</div>
|
| 203 |
+
<!-- User/Notification Icons (Keep as placeholders) -->
|
| 204 |
+
<div class="w-10 h-10 flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-full cursor-pointer" title="User Profile (Placeholder)">
|
| 205 |
+
<i class="ri-user-line text-gray-600 dark:text-gray-300"></i>
|
| 206 |
+
</div>
|
| 207 |
+
<div class="w-10 h-10 flex items-center justify-center relative cursor-pointer" title="Notifications (Placeholder)">
|
| 208 |
+
<i class="ri-notification-3-line text-gray-600 dark:text-gray-300"></i>
|
| 209 |
+
<span class="absolute top-0 right-0 bg-red-500 text-white text-xs w-5 h-5 flex items-center justify-center rounded-full">3</span>
|
| 210 |
+
</div>
|
| 211 |
+
<!-- Mobile Menu Button (Placeholder) -->
|
| 212 |
+
<button class="md:hidden w-10 h-10 flex items-center justify-center" aria-label="Toggle Menu">
|
| 213 |
+
<i class="ri-menu-line text-gray-600 dark:text-gray-300 text-xl"></i>
|
| 214 |
+
</button>
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
</header>
|
| 218 |
+
|
| 219 |
+
<!-- Main Content Area -->
|
| 220 |
+
<main class="flex-grow">
|
| 221 |
+
|
| 222 |
+
<div class="container mx-auto px-4">
|
| 223 |
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 lg:gap-8">
|
| 224 |
+
|
| 225 |
+
<!-- Input Column -->
|
| 226 |
+
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-100 dark:border-gray-700">
|
| 227 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white mb-4 border-b border-gray-200 dark:border-gray-600 pb-2">
|
| 228 |
+
<i class="ri-image-add-line mr-2 text-primary align-bottom"></i>
|
| 229 |
+
<span data-lang-en="Input Image" data-lang-hi="इनपुट छवि">Input Image</span>
|
| 230 |
+
</h2>
|
| 231 |
+
<p class="text-gray-600 dark:text-gray-400 text-sm mb-4" data-lang-en="Upload an image (PNG, JPG, JPEG) or select an example below." data-lang-hi="एक छवि (PNG, JPG, JPEG) अपलोड करें या नीचे दिए गए उदाहरण का चयन करें।">
|
| 232 |
+
Upload an image (PNG, JPG, JPEG) or select an example below.
|
| 233 |
+
</p>
|
| 234 |
+
|
| 235 |
+
<!-- File Input -->
|
| 236 |
+
<input type="file" id="imageUpload" accept="image/png, image/jpeg, image/jpg" class="hidden"/>
|
| 237 |
+
<div class="flex items-center mb-4">
|
| 238 |
+
<label for="imageUpload" class="bg-primary text-white px-4 py-2 rounded-button cursor-pointer hover:bg-blue-700 transition-colors text-sm inline-flex items-center mr-4 whitespace-nowrap">
|
| 239 |
+
<i class="ri-upload-2-line mr-2"></i>
|
| 240 |
+
<span data-lang-en="Choose File" data-lang-hi="फ़ाइल चुनें">Choose File</span>
|
| 241 |
+
</label>
|
| 242 |
+
<span id="fileName" class="text-gray-500 dark:text-gray-400 text-sm italic truncate" data-lang-en="No file chosen" data-lang-hi="कोई फ़ाइल नहीं चुनी गई">No file chosen</span>
|
| 243 |
+
</div>
|
| 244 |
+
|
| 245 |
+
<!-- Examples -->
|
| 246 |
+
<h3 class="text-md font-semibold text-gray-700 dark:text-gray-300 mb-2" data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</h3>
|
| 247 |
+
<div id="examplesContainer" class="grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 gap-2 mb-4">
|
| 248 |
+
<div class="col-span-full">
|
| 249 |
+
<span class="text-gray-500 dark:text-gray-400 text-sm" data-lang-en="Loading examples..." data-lang-hi="उदाहरण लोड हो रहे हैं...">Loading examples...</span>
|
| 250 |
+
</div>
|
| 251 |
+
</div>
|
| 252 |
+
|
| 253 |
+
<!-- Preview -->
|
| 254 |
+
<div id="imagePreviewContainer" class="mt-4 pt-4 border-t border-gray-200 dark:border-gray-600 hidden">
|
| 255 |
+
<h3 class="text-md font-semibold text-gray-700 dark:text-gray-300 mb-2 text-center" data-lang-en="Preview" data-lang-hi="पूर्वावलोकन">Preview</h3>
|
| 256 |
+
<div class="flex justify-center">
|
| 257 |
+
<img id="imagePreview" src="#" alt="Image Preview" class="max-h-60 w-auto rounded border bg-gray-50 dark:bg-gray-700 dark:border-gray-600 p-1"/>
|
| 258 |
+
</div>
|
| 259 |
+
</div>
|
| 260 |
+
</div>
|
| 261 |
+
|
| 262 |
+
<!-- Output Column -->
|
| 263 |
+
<div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md border border-gray-100 dark:border-gray-700 flex flex-col items-center justify-center">
|
| 264 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white mb-4 border-b border-gray-200 dark:border-gray-600 pb-2 w-full text-center">
|
| 265 |
+
<i class="ri-text mr-2 text-primary align-bottom"></i>
|
| 266 |
+
<span data-lang-en="Recognition Result" data-lang-hi="पहचान परिणाम">Recognition Result</span>
|
| 267 |
+
</h2>
|
| 268 |
+
|
| 269 |
+
<!-- Recognize Button -->
|
| 270 |
+
<div class="my-4">
|
| 271 |
+
<button id="predictButton" class="bg-green-600 text-white px-6 py-3 rounded-button font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed text-lg inline-flex items-center" disabled>
|
| 272 |
+
<i class="ri-search-line mr-2"></i>
|
| 273 |
+
<span data-lang-en="Recognize Word" data-lang-hi="शब्द पहचानें">Recognize Word</span>
|
| 274 |
+
</button>
|
| 275 |
+
</div>
|
| 276 |
+
|
| 277 |
+
<!-- Loading Indicator -->
|
| 278 |
+
<div id="loadingIndicator" class="flex items-center justify-center my-4 text-blue-600 dark:text-blue-400 hidden" style="min-height: 40px;">
|
| 279 |
+
<svg class="animate-spin -ml-1 mr-3 h-5 w-5 text-blue-600 dark:text-blue-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
| 280 |
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
| 281 |
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
| 282 |
+
</svg>
|
| 283 |
+
<span data-lang-en="Processing... Please wait." data-lang-hi="संसाधित हो रहा है... कृपया प्रतीक्षा करें।">Processing... Please wait.</span>
|
| 284 |
+
</div>
|
| 285 |
+
|
| 286 |
+
<!-- Result Display Area -->
|
| 287 |
+
<div id="resultDisplay" class="mt-4 p-4 bg-gray-100 dark:bg-gray-700 rounded-lg w-full text-center hidden" style="min-height: 100px;">
|
| 288 |
+
<h3 class="text-lg font-semibold text-gray-800 dark:text-white mb-3" data-lang-en="Predicted Text:" data-lang-hi="अनुमानित पाठ:">Predicted Text:</h3>
|
| 289 |
+
<p id="predictionText" class="text-4xl hindi-font font-bold text-gray-900 dark:text-white"></p>
|
| 290 |
+
<p id="probabilityText" class="text-gray-600 dark:text-gray-400 text-sm mt-2 mb-0"></p>
|
| 291 |
+
</div>
|
| 292 |
+
|
| 293 |
+
<!-- Error Display Area -->
|
| 294 |
+
<div id="errorDisplay" class="mt-4 p-3 bg-red-100 dark:bg-red-900 dark:bg-opacity-50 border border-red-300 dark:border-red-600 text-red-800 dark:text-red-200 rounded-lg w-full text-sm flex items-center hidden" role="alert">
|
| 295 |
+
<i class="ri-error-warning-fill mr-2 text-lg"></i>
|
| 296 |
+
<strong class="mr-1" data-lang-en="Error:" data-lang-hi="त्रुटि:">Error:</strong>
|
| 297 |
+
<span id="errorText"></span>
|
| 298 |
+
</div>
|
| 299 |
+
</div>
|
| 300 |
+
</div>
|
| 301 |
+
</div>
|
| 302 |
+
|
| 303 |
+
</main>
|
| 304 |
+
|
| 305 |
+
<!-- Footer -->
|
| 306 |
+
<footer class="bg-gray-900 text-gray-400 py-12"> <!-- Adjusted footer text color -->
|
| 307 |
+
<div class="container mx-auto px-4">
|
| 308 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
| 309 |
+
<div>
|
| 310 |
+
<!-- Add data-lang attributes to footer elements if needed -->
|
| 311 |
+
<a href="/" class="text-2xl font-['Pacifico'] text-white mb-4 inline-block" data-lang-en="HindiOCR" data-lang-hi="हिन्दी ओसीआर">HindiOCR</a>
|
| 312 |
+
<p class="mb-4 text-sm" data-lang-en="Transforming handwritten Hindi documents into digital text." data-lang-hi="हस्तलिखित हिंदी दस्तावेज़ों को डिजिटल टेक्स्ट में बदलना।">Transforming handwritten Hindi documents into digital text.</p>
|
| 313 |
+
<div class="flex space-x-4">
|
| 314 |
+
<a href="#" class="hover:text-white" title="GitHub (Placeholder)"><i class="ri-github-fill"></i></a>
|
| 315 |
+
<a href="#" class="hover:text-white" title="LinkedIn (Placeholder)"><i class="ri-linkedin-box-fill"></i></a>
|
| 316 |
+
</div>
|
| 317 |
+
</div>
|
| 318 |
+
<div>
|
| 319 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Quick Links" data-lang-hi="त्वरित लिंक्स">Quick Links</h3>
|
| 320 |
+
<ul class="space-y-2 text-sm">
|
| 321 |
+
<li><a href="/" class="hover:text-white" data-lang-en="Home" data-lang-hi="होम">Home</a></li>
|
| 322 |
+
<li><a href="/recognize" class="hover:text-white" data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a></li>
|
| 323 |
+
<li><a href="/examples" class="hover:text-white" data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a></li>
|
| 324 |
+
<li><a href="/technology" class="hover:text-white" data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a></li>
|
| 325 |
+
<li><a href="/about" class="hover:text-white" data-lang-en="About" data-lang-hi="बारे में">About</a></li>
|
| 326 |
+
</ul>
|
| 327 |
+
</div>
|
| 328 |
+
<div>
|
| 329 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Resources" data-lang-hi="संसाधन">Resources</h3>
|
| 330 |
+
<ul class="space-y-2 text-sm">
|
| 331 |
+
<li><a href="#" class="hover:text-white" data-lang-en="Documentation (TBD)" data-lang-hi="प्रलेखन (TBD)">Documentation (TBD)</a></li>
|
| 332 |
+
<li><a href="#" class="hover:text-white" data-lang-en="GitHub Repo (Link)" data-lang-hi="गिटहब रेपो (लिंक)">GitHub Repo (Link)</a></li>
|
| 333 |
+
<li><a href="#" class="hover:text-white" data-lang-en="Support (TBD)" data-lang-hi="समर्थन (TBD)">Support (TBD)</a></li>
|
| 334 |
+
</ul>
|
| 335 |
+
</div>
|
| 336 |
+
<div>
|
| 337 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Contact (Project)" data-lang-hi="संपर्क (परियोजना)">Contact (Project)</h3>
|
| 338 |
+
<ul class="space-y-2 text-sm">
|
| 339 |
+
<li class="flex items-start">
|
| 340 |
+
<i class="ri-mail-line mt-1 mr-2"></i>
|
| 341 |
+
<span>khansamayashaswini@gmail.com</span>
|
| 342 |
+
</li>
|
| 343 |
+
<li class="flex items-center">
|
| 344 |
+
<i class="ri-building-line mr-2"></i>
|
| 345 |
+
<span>MATS University,Raipur / NIC Durg</span>
|
| 346 |
+
</li>
|
| 347 |
+
</ul>
|
| 348 |
+
</div>
|
| 349 |
+
</div>
|
| 350 |
+
<!-- Copyright -->
|
| 351 |
+
<div class="border-t border-gray-700 mt-8 pt-8 text-center">
|
| 352 |
+
<p class="text-sm">© 2025 Yashaswini khansama | Final Year Project | NIC</p>
|
| 353 |
+
</div>
|
| 354 |
+
</div>
|
| 355 |
+
</footer>
|
| 356 |
+
|
| 357 |
+
<!-- Bootstrap JS Bundle (Not needed for Tailwind, can remove if not used elsewhere) -->
|
| 358 |
+
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> -->
|
| 359 |
+
|
| 360 |
+
<!-- Base Theme/Language Script -->
|
| 361 |
+
<script>
|
| 362 |
+
// --- Theme Toggle ---
|
| 363 |
+
const themeToggle = document.getElementById('themeToggle');
|
| 364 |
+
const htmlElement = document.documentElement; // Target <html> tag
|
| 365 |
+
|
| 366 |
+
// Function to apply theme based on preference
|
| 367 |
+
function applyTheme(isDark) {
|
| 368 |
+
if (isDark) {
|
| 369 |
+
htmlElement.classList.add('dark');
|
| 370 |
+
if(themeToggle) themeToggle.checked = true;
|
| 371 |
+
console.log("Theme applied: dark");
|
| 372 |
+
} else {
|
| 373 |
+
htmlElement.classList.remove('dark');
|
| 374 |
+
if(themeToggle) themeToggle.checked = false;
|
| 375 |
+
console.log("Theme applied: light");
|
| 376 |
+
}
|
| 377 |
+
}
|
| 378 |
+
|
| 379 |
+
// Check localStorage on load
|
| 380 |
+
const prefersDark = localStorage.getItem('theme') === 'dark' ||
|
| 381 |
+
(localStorage.getItem('theme') === null && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
| 382 |
+
applyTheme(prefersDark);
|
| 383 |
+
|
| 384 |
+
// Add listener to toggle button
|
| 385 |
+
if(themeToggle){
|
| 386 |
+
themeToggle.addEventListener('change', (event) => {
|
| 387 |
+
const isDark = event.target.checked;
|
| 388 |
+
applyTheme(isDark);
|
| 389 |
+
// Save preference to localStorage
|
| 390 |
+
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
| 391 |
+
});
|
| 392 |
+
} else {
|
| 393 |
+
console.warn("Theme toggle button not found.");
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
// --- Language Toggle (Simple Version) ---
|
| 397 |
+
const languageToggle = document.getElementById('languageToggle');
|
| 398 |
+
const langElements = document.querySelectorAll('[data-lang-en]'); // Select elements with language data
|
| 399 |
+
|
| 400 |
+
// Function to apply language
|
| 401 |
+
function applyLanguage(lang) { // lang should be 'en' or 'hi'
|
| 402 |
+
console.log("Applying language:", lang);
|
| 403 |
+
htmlElement.setAttribute('lang', lang); // Set overall page lang
|
| 404 |
+
|
| 405 |
+
langElements.forEach(el => {
|
| 406 |
+
const text = el.getAttribute(`data-lang-${lang}`);
|
| 407 |
+
if (text) {
|
| 408 |
+
el.textContent = text; // Replace text content
|
| 409 |
+
}
|
| 410 |
+
});
|
| 411 |
+
|
| 412 |
+
// Update toggle state
|
| 413 |
+
if (languageToggle) languageToggle.checked = (lang === 'hi');
|
| 414 |
+
|
| 415 |
+
// Save preference
|
| 416 |
+
localStorage.setItem('language', lang);
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
// Check localStorage on load for language
|
| 420 |
+
const savedLang = localStorage.getItem('language') || 'en'; // Default to English
|
| 421 |
+
applyLanguage(savedLang);
|
| 422 |
+
|
| 423 |
+
// Add listener to language toggle button
|
| 424 |
+
if (languageToggle) {
|
| 425 |
+
languageToggle.addEventListener('change', (event) => {
|
| 426 |
+
const newLang = event.target.checked ? 'hi' : 'en';
|
| 427 |
+
applyLanguage(newLang);
|
| 428 |
+
});
|
| 429 |
+
} else {
|
| 430 |
+
console.warn("Language toggle button not found.");
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
</script>
|
| 434 |
+
|
| 435 |
+
<!-- Block for page-specific scripts -->
|
| 436 |
+
|
| 437 |
+
</body>
|
| 438 |
+
</html>
|
technology.html
ADDED
|
@@ -0,0 +1,451 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<!-- Add lang attribute and potentially 'dark' class -->
|
| 3 |
+
<html lang="en" class=""> <!-- Start without 'dark' initially -->
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Technology Stack - NIC Project</title>
|
| 8 |
+
<!-- Tailwind CSS via CDN -->
|
| 9 |
+
<script src="https://cdn.tailwindcss.com/3.4.1"></script>
|
| 10 |
+
<script>
|
| 11 |
+
// *** Add dark mode strategy to Tailwind config ***
|
| 12 |
+
tailwind.config = {
|
| 13 |
+
darkMode: 'class', // Enable class-based dark mode
|
| 14 |
+
theme: {
|
| 15 |
+
extend: {
|
| 16 |
+
colors: {
|
| 17 |
+
primary: '#1a73e8',
|
| 18 |
+
secondary: '#e8f0fe',
|
| 19 |
+
// Define dark mode colors if needed, or rely on Tailwind's defaults
|
| 20 |
+
// dark: {
|
| 21 |
+
// background: '#1a202c',
|
| 22 |
+
// text: '#e2e8f0',
|
| 23 |
+
// }
|
| 24 |
+
},
|
| 25 |
+
borderRadius: {
|
| 26 |
+
'none': '0px', 'sm': '4px', DEFAULT: '8px', 'md': '12px',
|
| 27 |
+
'lg': '16px', 'xl': '20px', '2xl': '24px', '3xl': '32px',
|
| 28 |
+
'full': '9999px', 'button': '8px'
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
</script>
|
| 34 |
+
<!-- Fonts -->
|
| 35 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 36 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 37 |
+
<link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">
|
| 38 |
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 39 |
+
<!-- Icons -->
|
| 40 |
+
<link href="https://cdn.jsdelivr.net/npm/remixicon@4.2.0/fonts/remixicon.css" rel="stylesheet">
|
| 41 |
+
<!-- Custom Styles -->
|
| 42 |
+
<style>
|
| 43 |
+
/* --- Font Definitions (Ensure loaded via <link> tags in base.html) --- */
|
| 44 |
+
body {
|
| 45 |
+
font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
| 46 |
+
-webkit-font-smoothing: antialiased; /* Smoother fonts */
|
| 47 |
+
-moz-osx-font-smoothing: grayscale;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.hindi-font {
|
| 51 |
+
font-family: 'Noto Sans Devanagari', sans-serif;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
/* --- Custom Switch Styles (from provided HTML) --- */
|
| 55 |
+
.custom-switch {
|
| 56 |
+
position: relative;
|
| 57 |
+
display: inline-block;
|
| 58 |
+
width: 50px;
|
| 59 |
+
height: 24px;
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
.custom-switch-input {
|
| 63 |
+
opacity: 0;
|
| 64 |
+
width: 0;
|
| 65 |
+
height: 0;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
.custom-switch-slider {
|
| 69 |
+
position: absolute;
|
| 70 |
+
cursor: pointer;
|
| 71 |
+
top: 0;
|
| 72 |
+
left: 0;
|
| 73 |
+
right: 0;
|
| 74 |
+
bottom: 0;
|
| 75 |
+
background-color: #ccc; /* Default off color */
|
| 76 |
+
transition: .4s;
|
| 77 |
+
border-radius: 34px; /* Rounded */
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.custom-switch-slider:before {
|
| 81 |
+
position: absolute;
|
| 82 |
+
content: "";
|
| 83 |
+
height: 18px;
|
| 84 |
+
width: 18px;
|
| 85 |
+
left: 3px;
|
| 86 |
+
bottom: 3px;
|
| 87 |
+
background-color: white; /* Changed from original rgb(136, 145, 212) to white for consistency with dark mode logic in base.html */
|
| 88 |
+
transition: .4s;
|
| 89 |
+
border-radius: 50%; /* Circle */
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
.custom-switch-input:checked + .custom-switch-slider {
|
| 93 |
+
background-color: #1a73e8; /* Primary color when on */
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
.custom-switch-input:checked + .custom-switch-slider:before {
|
| 97 |
+
transform: translateX(26px); /* Move the circle */
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
/* --- Accessibility: Ensure focus is visible --- */
|
| 101 |
+
/* Tailwind's default focus rings are usually good, but this is a fallback */
|
| 102 |
+
*:focus-visible {
|
| 103 |
+
outline: 2px solid #1a73e8; /* Use primary color for focus */
|
| 104 |
+
outline-offset: 2px;
|
| 105 |
+
box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.3); /* Optional softer focus ring */
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/* --- Other Minimal Custom Styles (if any) --- */
|
| 109 |
+
|
| 110 |
+
/* Example: Add a specific style for the example image containers if needed beyond grid/aspect ratio */
|
| 111 |
+
.example-image-container {
|
| 112 |
+
/* Custom styles here */
|
| 113 |
+
/* aspect-ratio: 3 / 2; */ /* Tailwind handles aspect ratio now */
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
.example-image {
|
| 117 |
+
/* Custom image styles here */
|
| 118 |
+
}
|
| 119 |
+
/* Add base dark mode styles */
|
| 120 |
+
html.dark body {
|
| 121 |
+
background-color: #1a202c; /* Example dark background */
|
| 122 |
+
color: #e2e8f0; /* Example dark text */
|
| 123 |
+
}
|
| 124 |
+
html.dark header, html.dark footer { /* Adjust header/footer */
|
| 125 |
+
background-color: #2d3748;
|
| 126 |
+
color: #e2e8f0;
|
| 127 |
+
}
|
| 128 |
+
html.dark .card { /* Adjust card styles */
|
| 129 |
+
background-color: #2d3748;
|
| 130 |
+
border-color: #4a5568;
|
| 131 |
+
}
|
| 132 |
+
html.dark h1, html.dark h2, html.dark h3, html.dark h4, html.dark h5, html.dark h6, html.dark p, html.dark span, html.dark li, html.dark label, html.dark small {
|
| 133 |
+
/* Adjust general text elements */
|
| 134 |
+
color: #e2e8f0; /* Light text */
|
| 135 |
+
}
|
| 136 |
+
html.dark .text-gray-600, html.dark .text-gray-700, html.dark .text-gray-800, html.dark .text-gray-900 {
|
| 137 |
+
color: #a0aec0; /* Lighter gray for dark mode */
|
| 138 |
+
}
|
| 139 |
+
html.dark .text-muted {
|
| 140 |
+
color: #718096;
|
| 141 |
+
}
|
| 142 |
+
html.dark .bg-white { background-color: #2d3748 !important; }
|
| 143 |
+
html.dark .bg-gray-50 { background-color: #1a202c !important; }
|
| 144 |
+
html.dark .bg-gray-100 { background-color: #2d3748 !important; }
|
| 145 |
+
html.dark .border-gray-100, html.dark .border-gray-200 { border-color: #4a5568 !important; }
|
| 146 |
+
html.dark .hover\:bg-gray-50:hover { background-color: #4a5568 !important; }
|
| 147 |
+
html.dark .navbar-dark .navbar-brand, html.dark .navbar-dark .nav-link { color: #fff; }
|
| 148 |
+
html.dark .navbar-dark .nav-link.active { color: #fff; font-weight: bold; }
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
</style>
|
| 152 |
+
|
| 153 |
+
</head>
|
| 154 |
+
<!-- Add dark mode background/text for body base -->
|
| 155 |
+
<body class="bg-gray-50 dark:bg-gray-900 min-h-screen flex flex-col text-gray-900 dark:text-gray-200">
|
| 156 |
+
|
| 157 |
+
<!-- Header -->
|
| 158 |
+
<header class="bg-white dark:bg-gray-800 shadow-sm sticky top-0 z-50">
|
| 159 |
+
<div class="container mx-auto px-4 py-3 flex items-center justify-between">
|
| 160 |
+
<div class="flex items-center">
|
| 161 |
+
<!-- Add data-lang attribute -->
|
| 162 |
+
<a href="/" class="text-2xl font-['Pacifico'] text-primary mr-8" data-lang-en="HindiOCR" data-lang-hi="हिन्दी ओसीआर">HindiOCR</a>
|
| 163 |
+
<nav class="hidden md:flex space-x-6">
|
| 164 |
+
<a href="/index.html"
|
| 165 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 166 |
+
data-lang-en="Home" data-lang-hi="होम">Home</a>
|
| 167 |
+
<a href="/recognizer.html"
|
| 168 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 169 |
+
data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a>
|
| 170 |
+
<a href="/examples.html"
|
| 171 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 172 |
+
data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a>
|
| 173 |
+
<a href="/technology.html"
|
| 174 |
+
class="hover:text-primary dark:hover:text-blue-400 text-primary dark:text-blue-400 font-medium"
|
| 175 |
+
data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a>
|
| 176 |
+
<a href="/about.html"
|
| 177 |
+
class="hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300"
|
| 178 |
+
data-lang-en="About" data-lang-hi="बारे में">About</a>
|
| 179 |
+
</nav>
|
| 180 |
+
</div>
|
| 181 |
+
<!-- Right side header items -->
|
| 182 |
+
<div class="flex items-center space-x-4">
|
| 183 |
+
<!-- Language Switch -->
|
| 184 |
+
<div class="items-center space-x-2 hidden md:flex">
|
| 185 |
+
<span class="text-sm text-gray-600 dark:text-gray-400">EN</span>
|
| 186 |
+
<label class="custom-switch">
|
| 187 |
+
<!-- *** Add ID: languageToggle *** -->
|
| 188 |
+
<input type="checkbox" id="languageToggle" class="custom-switch-input">
|
| 189 |
+
<span class="custom-switch-slider"></span>
|
| 190 |
+
</label>
|
| 191 |
+
<span class="text-sm text-gray-600 dark:text-gray-400 hindi-font">हिंदी</span>
|
| 192 |
+
</div>
|
| 193 |
+
<!-- Theme Switch -->
|
| 194 |
+
<div class="items-center space-x-2 hidden md:flex">
|
| 195 |
+
<span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-sun-line"></i></span>
|
| 196 |
+
<label class="custom-switch">
|
| 197 |
+
<!-- *** Add ID: themeToggle *** -->
|
| 198 |
+
<input type="checkbox" id="themeToggle" class="custom-switch-input">
|
| 199 |
+
<span class="custom-switch-slider"></span>
|
| 200 |
+
</label>
|
| 201 |
+
<span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-moon-line"></i></span>
|
| 202 |
+
</div>
|
| 203 |
+
<!-- User/Notification Icons (Keep as placeholders) -->
|
| 204 |
+
<div class="w-10 h-10 flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-full cursor-pointer" title="User Profile (Placeholder)">
|
| 205 |
+
<i class="ri-user-line text-gray-600 dark:text-gray-300"></i>
|
| 206 |
+
</div>
|
| 207 |
+
<div class="w-10 h-10 flex items-center justify-center relative cursor-pointer" title="Notifications (Placeholder)">
|
| 208 |
+
<i class="ri-notification-3-line text-gray-600 dark:text-gray-300"></i>
|
| 209 |
+
<span class="absolute top-0 right-0 bg-red-500 text-white text-xs w-5 h-5 flex items-center justify-center rounded-full">3</span>
|
| 210 |
+
</div>
|
| 211 |
+
<!-- Mobile Menu Button (Placeholder) -->
|
| 212 |
+
<button class="md:hidden w-10 h-10 flex items-center justify-center" aria-label="Toggle Menu">
|
| 213 |
+
<i class="ri-menu-line text-gray-600 dark:text-gray-300 text-xl"></i>
|
| 214 |
+
</button>
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
</header>
|
| 218 |
+
|
| 219 |
+
<!-- Main Content Area -->
|
| 220 |
+
<main class="flex-grow">
|
| 221 |
+
|
| 222 |
+
<div class="container mx-auto px-4 py-8">
|
| 223 |
+
<div class="max-w-3xl mx-auto">
|
| 224 |
+
<div class="bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-700 overflow-hidden">
|
| 225 |
+
<div class="px-6 py-4 bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600">
|
| 226 |
+
<h2 class="text-xl font-semibold text-gray-800 dark:text-white flex items-center">
|
| 227 |
+
<i class="ri-flask-line mr-2 text-primary text-2xl"></i> <!-- Flask icon or other relevant icon -->
|
| 228 |
+
Technology Stack & Methodology
|
| 229 |
+
</h2>
|
| 230 |
+
</div>
|
| 231 |
+
<div class="p-6 md:p-8 space-y-6 text-gray-700 dark:text-gray-300 leading-relaxed">
|
| 232 |
+
<h3 class="text-2xl font-semibold text-gray-900 dark:text-white mb-4">Core Components</h3>
|
| 233 |
+
|
| 234 |
+
<div class="space-y-4">
|
| 235 |
+
<h4 class="text-lg font-semibold text-gray-800 dark:text-white pt-2">1. Deep Learning Model</h4>
|
| 236 |
+
<p>
|
| 237 |
+
The core recognition engine relies on a deep neural network architecture commonly used for sequence recognition tasks, particularly OCR. This typically involves:
|
| 238 |
+
</p>
|
| 239 |
+
<ul class="list-disc list-inside space-y-1 pl-4 text-gray-700 dark:text-gray-300">
|
| 240 |
+
<li><strong>Convolutional Neural Network (CNN) Layers:</strong> These layers act as feature extractors, automatically learning relevant visual patterns (like strokes, curves, loops) directly from the pixel data of the input word images.</li>
|
| 241 |
+
<li><strong>Recurrent Neural Network (RNN) Layers:</strong> Long Short-Term Memory (LSTM) or Gated Recurrent Unit (GRU) layers are often used after the CNN. They process the sequence of features extracted along the width of the image, capturing contextual information and dependencies between different parts of the word. Bidirectional RNNs are commonly employed to consider context from both left-to-right and right-to-left.</li>
|
| 242 |
+
<li><strong>Connectionist Temporal Classification (CTC) Loss:</strong> This loss function is essential for training OCR models without requiring pre-segmented character locations. It calculates the probability of the predicted sequence given the input image features, summing over all possible alignments between the input sequence and the target text label.</li>
|
| 243 |
+
</ul>
|
| 244 |
+
<p class="text-sm text-gray-600 dark:text-gray-400 italic mt-2">
|
| 245 |
+
<em>Specific Library Used: TensorFlow 1.15 (as indicated by logs)</em>
|
| 246 |
+
</p>
|
| 247 |
+
<!-- Optional: Model Diagram Placeholder -->
|
| 248 |
+
<!-- <div class="my-4 p-4 border rounded-md bg-gray-50 text-center text-gray-500">Model Architecture Diagram Placeholder</div> -->
|
| 249 |
+
</div>
|
| 250 |
+
|
| 251 |
+
<hr class="my-6 border-gray-200 dark:border-gray-600">
|
| 252 |
+
|
| 253 |
+
<div class="space-y-4">
|
| 254 |
+
<h4 class="text-lg font-semibold text-gray-800 dark:text-white">2. Image Preprocessing</h4>
|
| 255 |
+
<p>
|
| 256 |
+
Raw input images are processed before being fed into the neural network to ensure consistency and optimal performance. Steps (handled by `SamplePreprocessor.py`) include:
|
| 257 |
+
</p>
|
| 258 |
+
<ul class="list-disc list-inside space-y-1 pl-4 text-gray-700 dark:text-gray-300">
|
| 259 |
+
<li><strong>Grayscale Conversion:</strong> Converting the image to a single channel (grayscale) reduces complexity.</li>
|
| 260 |
+
<li><strong>Resizing:</strong> Images are typically resized to a fixed height (e.g., 32 or 64 pixels) while maintaining the aspect ratio. Width may vary or be padded to a maximum length.</li>
|
| 261 |
+
<li><strong>Normalization:</strong> Pixel values are scaled to a standard range (e.g., [0, 1] or [-1, 1]) to stabilize training.</li>
|
| 262 |
+
<li><em>(Mention any other significant steps like binarization, slant correction if applicable)</em></li>
|
| 263 |
+
</ul>
|
| 264 |
+
<p class="text-sm text-gray-600 dark:text-gray-400 italic mt-2">
|
| 265 |
+
<em>Primary Library Used: OpenCV (`cv2`)</em>
|
| 266 |
+
</p>
|
| 267 |
+
</div>
|
| 268 |
+
|
| 269 |
+
<hr class="my-6 border-gray-200 dark:border-gray-600">
|
| 270 |
+
|
| 271 |
+
<div class="space-y-4">
|
| 272 |
+
<h4 class="text-lg font-semibold text-gray-800 dark:text-white">3. Backend Framework</h4>
|
| 273 |
+
<p>
|
| 274 |
+
The server-side logic, API handling, and coordination are managed by **Flask**, a Python microframework known for its simplicity and flexibility. Flask's responsibilities in this project include:
|
| 275 |
+
</p>
|
| 276 |
+
<ul class="list-disc list-inside space-y-1 pl-4 text-gray-700 dark:text-gray-300">
|
| 277 |
+
<li>Defining URL routes (e.g., <code>/</code>, <code>/recognize</code>, <code>/predict</code>, <code>/api/examples</code>).</li>
|
| 278 |
+
<li>Handling HTTP requests (GET for pages, POST for predictions).</li>
|
| 279 |
+
<li>Receiving and securely saving uploaded image files.</li>
|
| 280 |
+
<li>Calling the Python functions in <code>main.py</code> to trigger image preprocessing and model inference.</li>
|
| 281 |
+
<li>Formatting the prediction results into JSON for the API endpoint.</li>
|
| 282 |
+
<li>Rendering HTML templates (using the Jinja2 engine) to display web pages.</li>
|
| 283 |
+
<li>Serving static assets like CSS, JavaScript, and images.</li>
|
| 284 |
+
</ul>
|
| 285 |
+
</div>
|
| 286 |
+
|
| 287 |
+
<hr class="my-6 border-gray-200 dark:border-gray-600">
|
| 288 |
+
|
| 289 |
+
<div class="space-y-4">
|
| 290 |
+
<h4 class="text-lg font-semibold text-gray-800 dark:text-white">4. Frontend Interface</h4>
|
| 291 |
+
<p>
|
| 292 |
+
The user interacts with the application through a web interface built using:
|
| 293 |
+
</p>
|
| 294 |
+
<ul class="list-disc list-inside space-y-1 pl-4 text-gray-700 dark:text-gray-300">
|
| 295 |
+
<li><strong>HTML5:</strong> Provides the fundamental structure and content of the web pages.</li>
|
| 296 |
+
<li><strong>Tailwind CSS:</strong> A utility-first CSS framework used for rapidly building the user interface. It provides low-level utility classes (like <code>p-6</code>, <code>rounded-lg</code>, <code>text-center</code>, <code>font-semibold</code>, <code>hidden</code>) to style elements directly in the HTML markup, promoting consistency and custom design without writing extensive custom CSS.</li>
|
| 297 |
+
<li><strong>Vanilla JavaScript:</strong> Handles all client-side interactivity, including:
|
| 298 |
+
<ul class="list-['○'] list-inside space-y-1 pl-6 mt-1">
|
| 299 |
+
<li>Managing file input selection and example image clicks.</li>
|
| 300 |
+
<li>Displaying image previews.</li>
|
| 301 |
+
<li>Making asynchronous API calls (<code>fetch</code>) to the Flask backend's <code>/predict</code> endpoint to send the image data.</li>
|
| 302 |
+
<li>Receiving and parsing the JSON response from the backend.</li>
|
| 303 |
+
<li>Dynamically updating the HTML to show prediction results, loading states, or error messages.</li>
|
| 304 |
+
<li>Handling basic UI state changes (e.g., enabling/disabling buttons).</li>
|
| 305 |
+
</ul>
|
| 306 |
+
</li>
|
| 307 |
+
<li><strong>Remixicon / Google Fonts:</strong> Used for icons and specific typography (Inter, Noto Sans Devanagari, Pacifico).</li>
|
| 308 |
+
</ul>
|
| 309 |
+
</div>
|
| 310 |
+
|
| 311 |
+
</div>
|
| 312 |
+
</div>
|
| 313 |
+
</div>
|
| 314 |
+
</div>
|
| 315 |
+
|
| 316 |
+
</main>
|
| 317 |
+
|
| 318 |
+
<!-- Footer -->
|
| 319 |
+
<footer class="bg-gray-900 text-gray-400 py-12"> <!-- Adjusted footer text color -->
|
| 320 |
+
<div class="container mx-auto px-4">
|
| 321 |
+
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
|
| 322 |
+
<div>
|
| 323 |
+
<!-- Add data-lang attributes to footer elements if needed -->
|
| 324 |
+
<a href="/" class="text-2xl font-['Pacifico'] text-white mb-4 inline-block" data-lang-en="HindiOCR" data-lang-hi="हिन्दी ओसीआर">HindiOCR</a>
|
| 325 |
+
<p class="mb-4 text-sm" data-lang-en="Transforming handwritten Hindi documents into digital text." data-lang-hi="हस्तलिखित हिंदी दस्तावेज़ों को डिजिटल टेक्स्ट में बदलना।">Transforming handwritten Hindi documents into digital text.</p>
|
| 326 |
+
<div class="flex space-x-4">
|
| 327 |
+
<a href="#" class="hover:text-white" title="GitHub (Placeholder)"><i class="ri-github-fill"></i></a>
|
| 328 |
+
<a href="#" class="hover:text-white" title="LinkedIn (Placeholder)"><i class="ri-linkedin-box-fill"></i></a>
|
| 329 |
+
</div>
|
| 330 |
+
</div>
|
| 331 |
+
<div>
|
| 332 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Quick Links" data-lang-hi="त्वरित लिंक्स">Quick Links</h3>
|
| 333 |
+
<ul class="space-y-2 text-sm">
|
| 334 |
+
<li><a href="/" class="hover:text-white" data-lang-en="Home" data-lang-hi="होम">Home</a></li>
|
| 335 |
+
<li><a href="/recognize" class="hover:text-white" data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a></li>
|
| 336 |
+
<li><a href="/examples" class="hover:text-white" data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a></li>
|
| 337 |
+
<li><a href="/technology" class="hover:text-white" data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a></li>
|
| 338 |
+
<li><a href="/about" class="hover:text-white" data-lang-en="About" data-lang-hi="बारे में">About</a></li>
|
| 339 |
+
</ul>
|
| 340 |
+
</div>
|
| 341 |
+
<div>
|
| 342 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Resources" data-lang-hi="संसाधन">Resources</h3>
|
| 343 |
+
<ul class="space-y-2 text-sm">
|
| 344 |
+
<li><a href="#" class="hover:text-white" data-lang-en="Documentation (TBD)" data-lang-hi="प्रलेखन (TBD)">Documentation (TBD)</a></li>
|
| 345 |
+
<li><a href="#" class="hover:text-white" data-lang-en="GitHub Repo (Link)" data-lang-hi="गिटहब रेपो (लिंक)">GitHub Repo (Link)</a></li>
|
| 346 |
+
<li><a href="#" class="hover:text-white" data-lang-en="Support (TBD)" data-lang-hi="समर्थन (TBD)">Support (TBD)</a></li>
|
| 347 |
+
</ul>
|
| 348 |
+
</div>
|
| 349 |
+
<div>
|
| 350 |
+
<h3 class="text-lg font-medium text-white mb-4" data-lang-en="Contact (Project)" data-lang-hi="संपर्क (परियोजना)">Contact (Project)</h3>
|
| 351 |
+
<ul class="space-y-2 text-sm">
|
| 352 |
+
<li class="flex items-start">
|
| 353 |
+
<i class="ri-mail-line mt-1 mr-2"></i>
|
| 354 |
+
<span>khansamayashaswini@gmail.com</span>
|
| 355 |
+
</li>
|
| 356 |
+
<li class="flex items-center">
|
| 357 |
+
<i class="ri-building-line mr-2"></i>
|
| 358 |
+
<span>MATS University,Raipur / NIC Durg</span>
|
| 359 |
+
</li>
|
| 360 |
+
</ul>
|
| 361 |
+
</div>
|
| 362 |
+
</div>
|
| 363 |
+
<!-- Copyright -->
|
| 364 |
+
<div class="border-t border-gray-700 mt-8 pt-8 text-center">
|
| 365 |
+
<p class="text-sm">© 2025 Yashaswini khansama | Final Year Project | NIC</p>
|
| 366 |
+
</div>
|
| 367 |
+
</div>
|
| 368 |
+
</footer>
|
| 369 |
+
|
| 370 |
+
<!-- Bootstrap JS Bundle (Not needed for Tailwind, can remove if not used elsewhere) -->
|
| 371 |
+
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> -->
|
| 372 |
+
|
| 373 |
+
<!-- Base Theme/Language Script -->
|
| 374 |
+
<script>
|
| 375 |
+
// --- Theme Toggle ---
|
| 376 |
+
const themeToggle = document.getElementById('themeToggle');
|
| 377 |
+
const htmlElement = document.documentElement; // Target <html> tag
|
| 378 |
+
|
| 379 |
+
// Function to apply theme based on preference
|
| 380 |
+
function applyTheme(isDark) {
|
| 381 |
+
if (isDark) {
|
| 382 |
+
htmlElement.classList.add('dark');
|
| 383 |
+
if(themeToggle) themeToggle.checked = true;
|
| 384 |
+
console.log("Theme applied: dark");
|
| 385 |
+
} else {
|
| 386 |
+
htmlElement.classList.remove('dark');
|
| 387 |
+
if(themeToggle) themeToggle.checked = false;
|
| 388 |
+
console.log("Theme applied: light");
|
| 389 |
+
}
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
// Check localStorage on load
|
| 393 |
+
const prefersDark = localStorage.getItem('theme') === 'dark' ||
|
| 394 |
+
(localStorage.getItem('theme') === null && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
| 395 |
+
applyTheme(prefersDark);
|
| 396 |
+
|
| 397 |
+
// Add listener to toggle button
|
| 398 |
+
if(themeToggle){
|
| 399 |
+
themeToggle.addEventListener('change', (event) => {
|
| 400 |
+
const isDark = event.target.checked;
|
| 401 |
+
applyTheme(isDark);
|
| 402 |
+
// Save preference to localStorage
|
| 403 |
+
localStorage.setItem('theme', isDark ? 'dark' : 'light');
|
| 404 |
+
});
|
| 405 |
+
} else {
|
| 406 |
+
console.warn("Theme toggle button not found.");
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
// --- Language Toggle (Simple Version) ---
|
| 410 |
+
const languageToggle = document.getElementById('languageToggle');
|
| 411 |
+
const langElements = document.querySelectorAll('[data-lang-en]'); // Select elements with language data
|
| 412 |
+
|
| 413 |
+
// Function to apply language
|
| 414 |
+
function applyLanguage(lang) { // lang should be 'en' or 'hi'
|
| 415 |
+
console.log("Applying language:", lang);
|
| 416 |
+
htmlElement.setAttribute('lang', lang); // Set overall page lang
|
| 417 |
+
|
| 418 |
+
langElements.forEach(el => {
|
| 419 |
+
const text = el.getAttribute(`data-lang-${lang}`);
|
| 420 |
+
if (text) {
|
| 421 |
+
el.textContent = text; // Replace text content
|
| 422 |
+
}
|
| 423 |
+
});
|
| 424 |
+
|
| 425 |
+
// Update toggle state
|
| 426 |
+
if (languageToggle) languageToggle.checked = (lang === 'hi');
|
| 427 |
+
|
| 428 |
+
// Save preference
|
| 429 |
+
localStorage.setItem('language', lang);
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
// Check localStorage on load for language
|
| 433 |
+
const savedLang = localStorage.getItem('language') || 'en'; // Default to English
|
| 434 |
+
applyLanguage(savedLang);
|
| 435 |
+
|
| 436 |
+
// Add listener to language toggle button
|
| 437 |
+
if (languageToggle) {
|
| 438 |
+
languageToggle.addEventListener('change', (event) => {
|
| 439 |
+
const newLang = event.target.checked ? 'hi' : 'en';
|
| 440 |
+
applyLanguage(newLang);
|
| 441 |
+
});
|
| 442 |
+
} else {
|
| 443 |
+
console.warn("Language toggle button not found.");
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
</script>
|
| 447 |
+
|
| 448 |
+
<!-- Block for page-specific scripts -->
|
| 449 |
+
|
| 450 |
+
</body>
|
| 451 |
+
</html>
|