Update src/streamlit_app.py
Browse files- src/streamlit_app.py +494 -757
src/streamlit_app.py
CHANGED
|
@@ -3,822 +3,559 @@ ISL Sign Language Translation - TechMatrix Solvers Initiative
|
|
| 3 |
Main Streamlit Application
|
| 4 |
|
| 5 |
Developed by: TechMatrix Solvers Team
|
| 6 |
-
- Abhay Gupta (Team Lead)
|
| 7 |
-
- Kripanshu Gupta (Backend Developer)
|
| 8 |
-
- Dipanshu Patel (UI/UX Designer)
|
| 9 |
-
- Bhumika Patel (Deployment & Female Presenter)
|
| 10 |
|
| 11 |
Institution: Shri Ram Group of Institutions
|
| 12 |
"""
|
| 13 |
|
| 14 |
import streamlit as st
|
| 15 |
-
|
| 16 |
-
|
| 17 |
import os
|
| 18 |
-
os.environ["KERAS_BACKEND"] = "torch"
|
| 19 |
-
import keras
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
import tempfile
|
| 24 |
-
import time
|
| 25 |
-
from PIL import Image
|
| 26 |
-
from keras.models import Sequential
|
| 27 |
-
import pickle
|
| 28 |
-
from keras.layers import LSTM, Dense, Bidirectional, Dropout, Input, BatchNormalization
|
| 29 |
-
from pose_models import create_bodypose_model, create_handpose_model
|
| 30 |
-
from expression_mapping import expression_mapping
|
| 31 |
-
from isl_processor import ISLTranslationModel
|
| 32 |
-
import pandas as pd
|
| 33 |
-
import ffmpeg
|
| 34 |
-
import subprocess
|
| 35 |
-
from typing import NamedTuple
|
| 36 |
-
import json
|
| 37 |
-
import pose_utils as utils
|
| 38 |
-
from huggingface_hub import hf_hub_download
|
| 39 |
-
import shutil, platform
|
| 40 |
-
import uuid
|
| 41 |
|
| 42 |
-
#
|
| 43 |
-
st.
|
| 44 |
-
|
| 45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
try:
|
|
|
|
|
|
|
| 48 |
import cv2
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
except Exception as e:
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
| 58 |
|
|
|
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
class VideoProbeResult(NamedTuple):
|
| 61 |
"""Structure for video probe results"""
|
| 62 |
return_code: int
|
| 63 |
json: str
|
| 64 |
error: str
|
| 65 |
|
| 66 |
-
|
| 67 |
def probe_video_info(file_path) -> VideoProbeResult:
|
| 68 |
-
"""
|
| 69 |
-
Probe video file for metadata using FFprobe
|
| 70 |
-
|
| 71 |
-
Args:
|
| 72 |
-
file_path: Path to video file
|
| 73 |
-
|
| 74 |
-
Returns:
|
| 75 |
-
VideoProbeResult containing metadata
|
| 76 |
-
"""
|
| 77 |
command_array = [
|
| 78 |
-
"ffprobe",
|
| 79 |
-
"-
|
| 80 |
-
"-print_format", "json",
|
| 81 |
-
"-show_format",
|
| 82 |
-
"-show_streams",
|
| 83 |
-
file_path
|
| 84 |
]
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
hand0_features = [f'hand0peaks_x_{i}' for i in range(21)] + [f'hand0peaks_y_{i}' for i in range(21)] + [f'hand0peaks_peaktxt{i}' for i in range(21)]
|
| 101 |
-
hand1_features = [f'hand1peaks_x_{i}' for i in range(21)] + [f'hand1peaks_y_{i}' for i in range(21)] + [f'hand1peaks_peaktxt{i}' for i in range(21)]
|
| 102 |
-
|
| 103 |
-
feature_columns_processed = body_features + hand0_features + hand1_features
|
| 104 |
-
label_columns = ['Expression_encoded']
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
@st.cache_resource
|
| 108 |
-
def create_time_series_sequences(isl_data, feature_columns, label_columns, window_size=20):
|
| 109 |
-
"""
|
| 110 |
-
Creates time series sequences from DataFrame with specified window size
|
| 111 |
-
|
| 112 |
-
Args:
|
| 113 |
-
isl_data: Input DataFrame with ISL data
|
| 114 |
-
feature_columns: List of feature column names
|
| 115 |
-
label_columns: List of label column names
|
| 116 |
-
window_size: Size of temporal window for sequence creation
|
| 117 |
-
|
| 118 |
-
Returns:
|
| 119 |
-
tuple: (X_sequences, y_sequences) for training/inference
|
| 120 |
-
"""
|
| 121 |
-
if isl_data.empty:
|
| 122 |
-
return [], []
|
| 123 |
-
|
| 124 |
-
X_sequences = []
|
| 125 |
-
y_sequences = []
|
| 126 |
-
|
| 127 |
-
for group, file_df in isl_data.groupby(['Type', 'Expression_encoded', 'FileName']):
|
| 128 |
-
expr_type, expression, filename = group
|
| 129 |
-
|
| 130 |
-
# Create blank frame for padding
|
| 131 |
-
blank_frame = np.zeros((1, 156))
|
| 132 |
-
|
| 133 |
-
for idx, window_data in enumerate([file_df[i:i+window_size] for i in range(0, file_df.shape[0], 1)]):
|
| 134 |
-
if window_data.shape[0] < window_size:
|
| 135 |
-
# Pad sequence with blank frames at the beginning
|
| 136 |
-
padding_needed = window_size - window_data.shape[0]
|
| 137 |
-
padded_sequence = np.concatenate(
|
| 138 |
-
(np.repeat(blank_frame, padding_needed, axis=0),
|
| 139 |
-
window_data[feature_columns].values),
|
| 140 |
-
axis=0
|
| 141 |
-
)
|
| 142 |
-
X_sequences.append(padded_sequence)
|
| 143 |
-
y_sequences.append(expression)
|
| 144 |
-
continue
|
| 145 |
-
|
| 146 |
-
X_sequences.append(window_data[feature_columns].values)
|
| 147 |
-
y_sequences.append(expression)
|
| 148 |
-
|
| 149 |
-
return X_sequences, y_sequences
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
# Global translation model variable
|
| 153 |
-
translation_model = None
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
@st.cache_resource
|
| 157 |
-
def load_translation_model():
|
| 158 |
-
"""
|
| 159 |
-
Load and configure the LSTM translation model
|
| 160 |
-
|
| 161 |
-
Returns:
|
| 162 |
-
Configured Keras Sequential model for ISL translation
|
| 163 |
-
"""
|
| 164 |
-
model = Sequential()
|
| 165 |
-
model.add(Input(shape=((20, 156))))
|
| 166 |
-
model.add(keras.layers.Masking(mask_value=0.))
|
| 167 |
-
model.add(BatchNormalization())
|
| 168 |
-
model.add(Bidirectional(LSTM(32, recurrent_dropout=0.2, return_sequences=True)))
|
| 169 |
-
|
| 170 |
-
model.add(Dropout(0.2))
|
| 171 |
-
model.add(Bidirectional(LSTM(32, recurrent_dropout=0.2)))
|
| 172 |
-
|
| 173 |
-
model.add(keras.layers.Activation('elu'))
|
| 174 |
-
model.add(Dense(32, use_bias=False, kernel_initializer='he_normal'))
|
| 175 |
-
|
| 176 |
-
model.add(BatchNormalization())
|
| 177 |
-
model.add(Dropout(0.2))
|
| 178 |
-
model.add(keras.layers.Activation('elu'))
|
| 179 |
-
model.add(Dense(32, kernel_initializer='he_normal', use_bias=False))
|
| 180 |
-
|
| 181 |
-
model.add(BatchNormalization())
|
| 182 |
-
model.add(keras.layers.Activation('elu'))
|
| 183 |
-
model.add(Dropout(0.2))
|
| 184 |
-
model.add(Dense(len(list(expression_mapping.keys())), activation='softmax'))
|
| 185 |
-
|
| 186 |
-
# Download pre-trained model weights
|
| 187 |
-
model_file = hf_hub_download(
|
| 188 |
-
repo_id="sunilsarolkar/isl-translation-model",
|
| 189 |
-
filename="isl_model_final.keras"
|
| 190 |
-
)
|
| 191 |
-
model.load_weights(model_file)
|
| 192 |
-
|
| 193 |
-
return model
|
| 194 |
-
|
| 195 |
|
| 196 |
-
# Load test data
|
| 197 |
@st.cache_data
|
| 198 |
def load_test_data():
|
| 199 |
"""Load test dataset and file information"""
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
class VideoWriter:
|
| 223 |
-
"""Custom video writer using FFmpeg for better compatibility"""
|
| 224 |
-
|
| 225 |
-
def __init__(self, output_file, input_fps, input_framesize, input_pix_fmt, input_vcodec):
|
| 226 |
-
self.ff_process = (
|
| 227 |
-
ffmpeg
|
| 228 |
-
.input('pipe:',
|
| 229 |
-
format='rawvideo',
|
| 230 |
-
pix_fmt="bgr24",
|
| 231 |
-
s=f'{input_framesize[1]}x{input_framesize[0]}',
|
| 232 |
-
r=input_fps)
|
| 233 |
-
.output(output_file, pix_fmt=input_pix_fmt, vcodec=input_vcodec)
|
| 234 |
-
.overwrite_output()
|
| 235 |
-
.run_async(pipe_stdin=True)
|
| 236 |
-
)
|
| 237 |
-
|
| 238 |
-
def write_frame(self, frame):
|
| 239 |
-
"""Write a single frame to the video"""
|
| 240 |
-
self.ff_process.stdin.write(frame.tobytes())
|
| 241 |
-
|
| 242 |
-
def close(self):
|
| 243 |
-
"""Close the video writer"""
|
| 244 |
-
self.ff_process.stdin.close()
|
| 245 |
-
self.ff_process.wait()
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
def calculate_weighted_average(numbers, weights):
|
| 249 |
-
"""
|
| 250 |
-
Calculate weighted average of numbers
|
| 251 |
-
|
| 252 |
-
Args:
|
| 253 |
-
numbers: List of numbers
|
| 254 |
-
weights: List of weights
|
| 255 |
-
|
| 256 |
-
Returns:
|
| 257 |
-
float: Weighted average
|
| 258 |
-
"""
|
| 259 |
-
if sum(weights) == 0:
|
| 260 |
-
return 0
|
| 261 |
-
return sum(x * y for x, y in zip(numbers, weights)) / sum(weights)
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
@st.cache_data
|
| 265 |
-
def resize_image(image, width=None, height=None, interpolation=cv2.INTER_AREA):
|
| 266 |
-
"""
|
| 267 |
-
Resize image maintaining aspect ratio
|
| 268 |
-
|
| 269 |
-
Args:
|
| 270 |
-
image: Input image
|
| 271 |
-
width: Target width
|
| 272 |
-
height: Target height
|
| 273 |
-
interpolation: OpenCV interpolation method
|
| 274 |
-
|
| 275 |
-
Returns:
|
| 276 |
-
Resized image
|
| 277 |
-
"""
|
| 278 |
-
dimensions = None
|
| 279 |
-
(h, w) = image.shape[:2]
|
| 280 |
-
|
| 281 |
-
if width is None and height is None:
|
| 282 |
-
return image
|
| 283 |
-
|
| 284 |
-
if width is None:
|
| 285 |
-
ratio = height / float(h)
|
| 286 |
-
dimensions = (int(w * ratio), height)
|
| 287 |
-
else:
|
| 288 |
-
ratio = width / float(w)
|
| 289 |
-
dimensions = (width, int(h * ratio))
|
| 290 |
-
|
| 291 |
-
resized = cv2.resize(image, dimensions, interpolation=interpolation)
|
| 292 |
-
return resized
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
# Configure Streamlit page
|
| 296 |
-
st.set_page_config(
|
| 297 |
-
page_title="ISL Translation - TechMatrix Solvers",
|
| 298 |
-
page_icon="π€",
|
| 299 |
-
layout="wide"
|
| 300 |
-
)
|
| 301 |
|
| 302 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
|
| 304 |
-
#
|
| 305 |
-
|
| 306 |
-
"""
|
| 307 |
-
<style>
|
| 308 |
-
[data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
|
| 309 |
-
width: 350px;
|
| 310 |
-
}
|
| 311 |
-
[data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
|
| 312 |
-
width: 350px;
|
| 313 |
-
margin-left: -350px;
|
| 314 |
-
}
|
| 315 |
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
border-radius: 0.5rem;
|
| 320 |
-
margin: 1rem 0;
|
| 321 |
-
}
|
| 322 |
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
border-radius: 0.5rem;
|
| 328 |
-
text-align: center;
|
| 329 |
-
margin-bottom: 1rem;
|
| 330 |
-
}
|
| 331 |
-
</style>
|
| 332 |
-
""",
|
| 333 |
-
unsafe_allow_html=True,
|
| 334 |
-
)
|
| 335 |
-
|
| 336 |
-
# Add team branding header
|
| 337 |
-
st.markdown(
|
| 338 |
-
"""
|
| 339 |
-
<div class="tech-matrix-header">
|
| 340 |
-
<h2>π TechMatrix Solvers</h2>
|
| 341 |
-
<p>Innovating Accessible Technology Solutions</p>
|
| 342 |
-
</div>
|
| 343 |
-
""",
|
| 344 |
-
unsafe_allow_html=True
|
| 345 |
-
)
|
| 346 |
-
|
| 347 |
-
# Sidebar configuration
|
| 348 |
-
st.sidebar.title('π€ ISL Translation System')
|
| 349 |
-
st.sidebar.subheader('Configuration')
|
| 350 |
-
|
| 351 |
-
# Team information in sidebar
|
| 352 |
-
st.sidebar.markdown(
|
| 353 |
-
"""
|
| 354 |
-
<div class="team-info">
|
| 355 |
-
<h3>π¨βπ» Development Team</h3>
|
| 356 |
-
<ul>
|
| 357 |
-
<li><strong>Abhay Gupta</strong> - Team Lead</li>
|
| 358 |
-
<li><strong>Kripanshu Gupta</strong> - Backend Dev</li>
|
| 359 |
-
<li><strong>Dipanshu Patel</strong> - UI/UX Designer</li>
|
| 360 |
-
<li><strong>Bhumika Patel</strong> - Deployment</li>
|
| 361 |
-
</ul>
|
| 362 |
-
<p><em>Shri Ram Group of Institutions</em></p>
|
| 363 |
-
</div>
|
| 364 |
-
""",
|
| 365 |
-
unsafe_allow_html=True
|
| 366 |
-
)
|
| 367 |
-
|
| 368 |
-
# Initialize frame-wise outputs storage
|
| 369 |
-
frame_predictions = {}
|
| 370 |
-
|
| 371 |
-
# Application mode selection
|
| 372 |
-
app_mode = st.sidebar.selectbox(
|
| 373 |
-
'Choose Application Mode',
|
| 374 |
-
['About Project', 'Test Video Translation']
|
| 375 |
-
)
|
| 376 |
-
|
| 377 |
-
if app_mode == 'About Project':
|
| 378 |
-
st.markdown(
|
| 379 |
-
"""
|
| 380 |
-
## π― Project Overview
|
| 381 |
-
|
| 382 |
-
Welcome to the **ISL Sign Language Translation System** developed by **TechMatrix Solvers**.
|
| 383 |
-
This cutting-edge application demonstrates real-time Indian Sign Language recognition and
|
| 384 |
-
translation using advanced deep learning techniques.
|
| 385 |
-
|
| 386 |
-
### ποΈ Technical Architecture
|
| 387 |
-
|
| 388 |
-
Our system combines multiple state-of-the-art technologies:
|
| 389 |
-
|
| 390 |
-
1. **Body Pose Estimation**: 25-point skeletal tracking using OpenPose
|
| 391 |
-
2. **Hand Landmark Detection**: 21-point hand keypoint identification
|
| 392 |
-
3. **Temporal Modeling**: Bidirectional LSTM networks for sequence analysis
|
| 393 |
-
4. **Real-time Processing**: Optimized inference pipeline for live translation
|
| 394 |
-
"""
|
| 395 |
-
)
|
| 396 |
-
|
| 397 |
-
st.markdown(
|
| 398 |
-
"""
|
| 399 |
-
### π Dataset Information
|
| 400 |
-
|
| 401 |
-
Our model is trained on the comprehensive [INCLUDE dataset](https://zenodo.org/records/4010759):
|
| 402 |
-
"""
|
| 403 |
-
)
|
| 404 |
-
|
| 405 |
-
# Dataset statistics table
|
| 406 |
-
dataset_stats = {
|
| 407 |
-
"Metric": [
|
| 408 |
-
"Categories", "Total Words", "Training Videos",
|
| 409 |
-
"Avg Videos/Class", "Avg Video Length", "Resolution", "Frame Rate"
|
| 410 |
-
],
|
| 411 |
-
"Value": [
|
| 412 |
-
"15", "263", "4,257", "16.3", "2.57s", "1920x1080", "25fps"
|
| 413 |
-
]
|
| 414 |
-
}
|
| 415 |
-
st.table(pd.DataFrame(dataset_stats))
|
| 416 |
|
| 417 |
-
#
|
| 418 |
-
|
| 419 |
-
categories_image = np.array(Image.open('original_project/categories_processed.png'))
|
| 420 |
-
st.image(categories_image, caption="π Processed Categories Distribution")
|
| 421 |
-
except:
|
| 422 |
-
st.info("π Dataset visualization images will be displayed when available")
|
| 423 |
-
|
| 424 |
-
# Model architecture information
|
| 425 |
-
st.markdown(
|
| 426 |
-
"""
|
| 427 |
-
### π§ Neural Network Architecture
|
| 428 |
-
|
| 429 |
-
```python
|
| 430 |
-
# TechMatrix Solvers LSTM Translation Model
|
| 431 |
-
model = Sequential([
|
| 432 |
-
Input(shape=(20, 156)), # 20-frame temporal window
|
| 433 |
-
Masking(mask_value=0.),
|
| 434 |
-
BatchNormalization(),
|
| 435 |
-
Bidirectional(LSTM(32, recurrent_dropout=0.2, return_sequences=True)),
|
| 436 |
-
Dropout(0.2),
|
| 437 |
-
Bidirectional(LSTM(32, recurrent_dropout=0.2)),
|
| 438 |
-
Dense(32, activation='elu'),
|
| 439 |
-
BatchNormalization(),
|
| 440 |
-
Dropout(0.2),
|
| 441 |
-
Dense(len(expression_mapping), activation='softmax')
|
| 442 |
-
])
|
| 443 |
-
```
|
| 444 |
-
|
| 445 |
-
**Model Statistics:**
|
| 446 |
-
- Total Parameters: 82,679 (322.96 KB)
|
| 447 |
-
- Trainable Parameters: 82,239 (321.25 KB)
|
| 448 |
-
- Input Features: 156-dimensional vectors
|
| 449 |
-
- Temporal Window: 20 frames
|
| 450 |
-
"""
|
| 451 |
-
)
|
| 452 |
-
|
| 453 |
-
# Technology stack
|
| 454 |
-
col1, col2 = st.columns(2)
|
| 455 |
|
| 456 |
with col1:
|
| 457 |
-
st.markdown(
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
- Custom CSS Styling
|
| 464 |
-
- Responsive Design
|
| 465 |
-
|
| 466 |
-
**Deep Learning:**
|
| 467 |
-
- Keras/TensorFlow Backend
|
| 468 |
-
- PyTorch Integration
|
| 469 |
-
- LSTM Networks
|
| 470 |
-
- OpenPose Models
|
| 471 |
-
"""
|
| 472 |
-
)
|
| 473 |
|
| 474 |
with col2:
|
| 475 |
-
st.markdown(
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
**
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
| **Kripanshu Gupta** | Backend Developer | guptakripanshu83@gmail.com | 7067058400 |
|
| 504 |
-
| **Dipanshu Patel** | UI/UX Designer | dipanshupatel43@gmail.com | 9294526404 |
|
| 505 |
-
| **Bhumika Patel** | Deployment & Presenter | bp7249951@gmail.com | 9302271422 |
|
| 506 |
-
|
| 507 |
-
**Institution:** Shri Ram Group of Institutions
|
| 508 |
-
|
| 509 |
-
### π Documentation
|
| 510 |
|
| 511 |
-
|
| 512 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 513 |
|
| 514 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 515 |
|
| 516 |
-
|
| 517 |
-
"""
|
| 518 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 519 |
|
| 520 |
-
elif app_mode == '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 521 |
# Video selection interface
|
| 522 |
-
st.markdown("
|
| 523 |
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
|
|
|
|
|
|
|
|
|
| 528 |
|
| 529 |
# Filter by category
|
| 530 |
-
|
| 531 |
-
test_files_category = test_files_df[category_mask]
|
| 532 |
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
|
|
|
| 537 |
|
| 538 |
# Filter by class
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
|
|
|
|
|
|
| 544 |
|
| 545 |
# Display selection info
|
| 546 |
-
st.info(f"π Selected: {category} β {class_name} β {filename}")
|
| 547 |
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
data_mask = ((testing_df['FileName'] == filename) &
|
| 551 |
-
(testing_df['Type'] == category) &
|
| 552 |
-
(testing_df['Expression'] == class_name))
|
| 553 |
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
if current_test_data.empty:
|
| 558 |
-
st.error(f"β οΈ No matching data found for: {filename} | {category} | {class_name}")
|
| 559 |
-
st.stop()
|
| 560 |
-
else:
|
| 561 |
-
st.success(f"β
Loaded {current_test_data.shape[0]} frames for processing")
|
| 562 |
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
)
|
| 567 |
-
X_test_processed = np.array(X_test_processed)
|
| 568 |
-
|
| 569 |
-
# Configure Streamlit display options
|
| 570 |
-
st.set_option('deprecation.showfileUploaderEncoding', False)
|
| 571 |
-
|
| 572 |
-
st.sidebar.markdown('---')
|
| 573 |
-
st.markdown(
|
| 574 |
-
"""
|
| 575 |
-
<style>
|
| 576 |
-
[data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
|
| 577 |
-
width: 400px;
|
| 578 |
-
}
|
| 579 |
-
[data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
|
| 580 |
-
width: 400px;
|
| 581 |
-
margin-left: -400px;
|
| 582 |
-
}
|
| 583 |
-
</style>
|
| 584 |
-
""",
|
| 585 |
-
unsafe_allow_html=True,
|
| 586 |
-
)
|
| 587 |
-
|
| 588 |
-
st.sidebar.markdown('---')
|
| 589 |
-
st.markdown('## π Translation Results')
|
| 590 |
-
|
| 591 |
-
# Progress tracking container
|
| 592 |
-
progress_container = st.empty()
|
| 593 |
-
|
| 594 |
-
with progress_container.container():
|
| 595 |
-
progress_df = pd.DataFrame([['--', '--']],
|
| 596 |
-
columns=['Frames Processed', 'Detected Sign'])
|
| 597 |
-
progress_table = st.table(progress_df)
|
| 598 |
|
| 599 |
-
|
| 600 |
-
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 627 |
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 636 |
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
|
|
|
| 641 |
|
| 642 |
-
|
|
|
|
|
|
|
|
|
|
| 643 |
|
| 644 |
try:
|
| 645 |
-
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
|
| 659 |
-
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
|
| 672 |
-
|
| 673 |
-
|
| 674 |
-
|
| 675 |
-
|
| 676 |
-
|
| 677 |
-
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
-
video_writer = VideoWriter(output_file, input_fps, input_framesize,
|
| 683 |
-
input_pix_fmt, input_vcodec)
|
| 684 |
-
|
| 685 |
-
video_writer.write_frame(canvas_with_predictions)
|
| 686 |
-
|
| 687 |
-
# Update progress display
|
| 688 |
-
with progress_container.container():
|
| 689 |
-
progress_df = pd.DataFrame(
|
| 690 |
-
[[f'{frame_idx + 1}/{current_test_data.shape[0]}',
|
| 691 |
-
'<Building 20-frame buffer>']],
|
| 692 |
-
columns=['Frames Processed', 'Detected Sign']
|
| 693 |
-
)
|
| 694 |
-
progress_table = st.table(progress_df)
|
| 695 |
-
|
| 696 |
-
frame_buffer.append(frame)
|
| 697 |
-
|
| 698 |
-
# Display current frame
|
| 699 |
-
with video_display.container():
|
| 700 |
-
st.image(canvas_with_predictions, channels='BGR', use_column_width=True)
|
| 701 |
-
else:
|
| 702 |
-
# Process with full buffer - make predictions
|
| 703 |
-
frame_buffer[:-1] = frame_buffer[1:]
|
| 704 |
-
frame_buffer[-1] = frame
|
| 705 |
-
|
| 706 |
-
# Load translation model
|
| 707 |
-
translation_model = load_translation_model()
|
| 708 |
-
|
| 709 |
-
# Make prediction on current window
|
| 710 |
-
sequence_idx = frame_idx - 20
|
| 711 |
-
prediction_output = translation_model(
|
| 712 |
-
X_test_processed[sequence_idx].reshape(
|
| 713 |
-
1, X_test_processed[sequence_idx].shape[0],
|
| 714 |
-
X_test_processed[sequence_idx].shape[1]
|
| 715 |
-
)
|
| 716 |
-
)
|
| 717 |
-
prediction_output = prediction_output[0].cpu().detach().numpy()
|
| 718 |
-
|
| 719 |
-
# Get top predictions
|
| 720 |
-
top_prediction_idx = np.argmax(prediction_output)
|
| 721 |
-
top_3_indices = prediction_output.argsort()[-3:][::-1]
|
| 722 |
-
top_3_signs = [expression_mapping[i] for i in top_3_indices]
|
| 723 |
-
top_3_probabilities = prediction_output[top_3_indices]
|
| 724 |
-
|
| 725 |
-
# Update frame-wise predictions for weighted average
|
| 726 |
-
for sign, prob in zip(top_3_signs, top_3_probabilities):
|
| 727 |
-
if sign not in frame_predictions:
|
| 728 |
-
frame_predictions[sign] = []
|
| 729 |
-
frame_predictions[sign].append(prob)
|
| 730 |
-
|
| 731 |
-
# Current frame predictions
|
| 732 |
-
current_predictions = {}
|
| 733 |
-
for sign, prob in zip(top_3_signs, top_3_probabilities):
|
| 734 |
-
current_predictions[sign] = prob
|
| 735 |
-
|
| 736 |
-
# Calculate weighted averages
|
| 737 |
-
for sign in frame_predictions:
|
| 738 |
-
sign_predictions = frame_predictions[sign]
|
| 739 |
-
sign_weights = [len(sign_predictions) for _ in range(len(sign_predictions))]
|
| 740 |
-
weighted_predictions[sign] = calculate_weighted_average(
|
| 741 |
-
sign_predictions, sign_weights
|
| 742 |
-
)
|
| 743 |
-
|
| 744 |
-
# Sort predictions by confidence
|
| 745 |
-
sorted_predictions = dict(
|
| 746 |
-
sorted(weighted_predictions.items(), key=lambda item: item[1], reverse=True)
|
| 747 |
-
)
|
| 748 |
-
|
| 749 |
-
# Create visualization
|
| 750 |
-
visualization_canvas = utils.render_stick_model(
|
| 751 |
-
frame,
|
| 752 |
-
eval(frame_data['bodypose_circles']),
|
| 753 |
-
eval(frame_data['bodypose_sticks']),
|
| 754 |
-
eval(frame_data['handpose_edges']),
|
| 755 |
-
eval(frame_data['handpose_peaks'])
|
| 756 |
-
)
|
| 757 |
-
|
| 758 |
-
# Add prediction visualizations
|
| 759 |
-
canvas_with_predictions = utils.create_bar_plot_visualization(
|
| 760 |
-
visualization_canvas, current_predictions,
|
| 761 |
-
f'Current Window Prediction (Frames {sequence_idx + 1}-{frame_idx + 1})',
|
| 762 |
-
visualization_canvas
|
| 763 |
-
)
|
| 764 |
-
canvas_with_predictions = utils.create_bar_plot_visualization(
|
| 765 |
-
canvas_with_predictions, weighted_predictions,
|
| 766 |
-
f'Cumulative Weighted Average - Frame {frame_idx + 1}',
|
| 767 |
-
visualization_canvas
|
| 768 |
-
)
|
| 769 |
-
canvas_with_predictions = utils.add_bottom_padding(
|
| 770 |
-
canvas_with_predictions, (255, 255, 255), 100
|
| 771 |
-
)
|
| 772 |
-
|
| 773 |
-
video_writer.write_frame(canvas_with_predictions)
|
| 774 |
-
|
| 775 |
-
# Get best prediction for display
|
| 776 |
-
best_sign = max(weighted_predictions, key=weighted_predictions.get)
|
| 777 |
-
best_confidence = weighted_predictions[best_sign]
|
| 778 |
-
|
| 779 |
-
# Update progress display
|
| 780 |
-
with progress_container.container():
|
| 781 |
-
progress_df = pd.DataFrame(
|
| 782 |
-
[[f'{frame_idx + 1}/{current_test_data.shape[0]}',
|
| 783 |
-
f'{best_sign} ({best_confidence * 100:.2f}%)']],
|
| 784 |
-
columns=['Frames Processed', 'Detected Sign']
|
| 785 |
-
)
|
| 786 |
-
progress_table = st.table(progress_df)
|
| 787 |
-
|
| 788 |
-
# Display current frame
|
| 789 |
-
with video_display.container():
|
| 790 |
-
st.image(canvas_with_predictions, channels='BGR', use_column_width=True)
|
| 791 |
-
|
| 792 |
-
frame_idx += 1
|
| 793 |
-
|
| 794 |
-
# Finalize video processing
|
| 795 |
-
st.success("β
Video processing completed!")
|
| 796 |
-
|
| 797 |
-
with video_display.container():
|
| 798 |
-
if video_writer is not None:
|
| 799 |
-
video_writer.close()
|
| 800 |
-
with open(output_file, 'rb') as video_file:
|
| 801 |
-
output_video_bytes = video_file.read()
|
| 802 |
-
st.video(output_video_bytes)
|
| 803 |
-
st.info(f"πΎ Processed video saved: {output_file}")
|
| 804 |
-
else:
|
| 805 |
-
st.warning("β οΈ No video output generated")
|
| 806 |
-
|
| 807 |
-
finally:
|
| 808 |
-
# Clean up resources
|
| 809 |
-
video_capture.release()
|
| 810 |
-
if video_writer is not None:
|
| 811 |
-
video_writer.close()
|
| 812 |
-
cv2.destroyAllWindows()
|
| 813 |
|
| 814 |
# Footer
|
| 815 |
-
st.markdown(
|
| 816 |
-
|
| 817 |
-
|
| 818 |
-
<
|
| 819 |
-
<p><strong>
|
| 820 |
-
<p>
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
Main Streamlit Application
|
| 4 |
|
| 5 |
Developed by: TechMatrix Solvers Team
|
| 6 |
+
- Abhay Gupta (Team Lead) - contact2abhaygupta6187@gmail.com
|
| 7 |
+
- Kripanshu Gupta (Backend Developer) - guptakripanshu83@gmail.com
|
| 8 |
+
- Dipanshu Patel (UI/UX Designer) - dipanshupatel43@gmail.com
|
| 9 |
+
- Bhumika Patel (Deployment & Female Presenter) - bp7249951@gmail.com
|
| 10 |
|
| 11 |
Institution: Shri Ram Group of Institutions
|
| 12 |
"""
|
| 13 |
|
| 14 |
import streamlit as st
|
| 15 |
+
import sys
|
|
|
|
| 16 |
import os
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
# Add parent directory to path for imports
|
| 19 |
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
# Configure Streamlit page first
|
| 22 |
+
st.set_page_config(
|
| 23 |
+
page_title="ISL Translation - TechMatrix Solvers",
|
| 24 |
+
page_icon="π€",
|
| 25 |
+
layout="wide",
|
| 26 |
+
initial_sidebar_state="expanded",
|
| 27 |
+
menu_items={
|
| 28 |
+
'Get Help': 'https://docs.google.com/document/d/1mzr2KGHRJT5heUjFF20NQ3Gb89urpjZJ/edit?usp=sharing',
|
| 29 |
+
'Report a bug': "mailto:contact2abhaygupta6187@gmail.com",
|
| 30 |
+
'About': "# TechMatrix Solvers ISL Translation System\nAdvanced Indian Sign Language translation using deep learning!"
|
| 31 |
+
}
|
| 32 |
+
)
|
| 33 |
|
| 34 |
+
# Initialize session state
|
| 35 |
+
if 'app_initialized' not in st.session_state:
|
| 36 |
+
st.session_state.app_initialized = False
|
| 37 |
+
|
| 38 |
+
# Show loading message
|
| 39 |
+
loading_placeholder = st.empty()
|
| 40 |
+
with loading_placeholder:
|
| 41 |
+
st.markdown("""
|
| 42 |
+
<div style="text-align: center; padding: 50px;">
|
| 43 |
+
<h1>π TechMatrix Solvers</h1>
|
| 44 |
+
<h2>ISL Translation System</h2>
|
| 45 |
+
<p>Loading advanced AI models...</p>
|
| 46 |
+
</div>
|
| 47 |
+
""", unsafe_allow_html=True)
|
| 48 |
+
|
| 49 |
+
# Import dependencies with comprehensive error handling
|
| 50 |
try:
|
| 51 |
+
import numpy as np
|
| 52 |
+
import pandas as pd
|
| 53 |
import cv2
|
| 54 |
+
import time
|
| 55 |
+
import tempfile
|
| 56 |
+
import json
|
| 57 |
+
import uuid
|
| 58 |
+
import platform
|
| 59 |
+
import shutil
|
| 60 |
+
from PIL import Image
|
| 61 |
+
from typing import NamedTuple
|
| 62 |
+
import subprocess
|
| 63 |
+
|
| 64 |
+
# Set environment variables
|
| 65 |
+
os.environ["KERAS_BACKEND"] = "torch"
|
| 66 |
+
|
| 67 |
+
# Deep learning imports
|
| 68 |
+
import keras
|
| 69 |
+
from keras.models import Sequential
|
| 70 |
+
from keras.layers import LSTM, Dense, Bidirectional, Dropout, Input, BatchNormalization
|
| 71 |
+
|
| 72 |
+
# Video processing
|
| 73 |
+
import ffmpeg
|
| 74 |
+
|
| 75 |
+
# HuggingFace
|
| 76 |
+
from huggingface_hub import hf_hub_download
|
| 77 |
+
|
| 78 |
+
# Custom imports
|
| 79 |
+
from pose_models import create_bodypose_model, create_handpose_model
|
| 80 |
+
from expression_mapping import expression_mapping
|
| 81 |
+
from isl_processor import ISLTranslationModel
|
| 82 |
+
import pose_utils as utils
|
| 83 |
+
|
| 84 |
+
# Clear loading message and show success
|
| 85 |
+
loading_placeholder.empty()
|
| 86 |
+
st.success("β
TechMatrix Solvers ISL System loaded successfully!")
|
| 87 |
+
st.session_state.app_initialized = True
|
| 88 |
+
|
| 89 |
+
except ImportError as e:
|
| 90 |
+
loading_placeholder.empty()
|
| 91 |
+
st.error(f"β Failed to load dependencies: {e}")
|
| 92 |
+
st.error("Please ensure all required packages are installed.")
|
| 93 |
+
st.stop()
|
| 94 |
except Exception as e:
|
| 95 |
+
loading_placeholder.empty()
|
| 96 |
+
st.error(f"β Unexpected error during initialization: {e}")
|
| 97 |
+
st.stop()
|
| 98 |
+
|
| 99 |
+
# Main application layout
|
| 100 |
+
st.markdown("""
|
| 101 |
+
<style>
|
| 102 |
+
.main-header {
|
| 103 |
+
background: linear-gradient(90deg, #1e3a8a, #7c3aed);
|
| 104 |
+
color: white;
|
| 105 |
+
padding: 2rem;
|
| 106 |
+
border-radius: 10px;
|
| 107 |
+
text-align: center;
|
| 108 |
+
margin-bottom: 2rem;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
.team-card {
|
| 112 |
+
background-color: #f8fafc;
|
| 113 |
+
border: 1px solid #e2e8f0;
|
| 114 |
+
border-radius: 8px;
|
| 115 |
+
padding: 1rem;
|
| 116 |
+
margin: 1rem 0;
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
.feature-box {
|
| 120 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 121 |
+
color: white;
|
| 122 |
+
padding: 1.5rem;
|
| 123 |
+
border-radius: 10px;
|
| 124 |
+
margin: 1rem 0;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
.stat-card {
|
| 128 |
+
background-color: #ffffff;
|
| 129 |
+
border: 1px solid #d1d5db;
|
| 130 |
+
border-radius: 8px;
|
| 131 |
+
padding: 1rem;
|
| 132 |
+
text-align: center;
|
| 133 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
| 134 |
+
}
|
| 135 |
+
</style>
|
| 136 |
+
""", unsafe_allow_html=True)
|
| 137 |
+
|
| 138 |
+
# Header
|
| 139 |
+
st.markdown("""
|
| 140 |
+
<div class="main-header">
|
| 141 |
+
<h1>π€ ISL Sign Language Translation</h1>
|
| 142 |
+
<h2>TechMatrix Solvers Initiative</h2>
|
| 143 |
+
<p>Advanced AI-Powered Indian Sign Language Recognition & Translation</p>
|
| 144 |
+
</div>
|
| 145 |
+
""", unsafe_allow_html=True)
|
| 146 |
|
| 147 |
+
# Sidebar configuration
|
| 148 |
+
st.sidebar.markdown("""
|
| 149 |
+
<div style="text-align: center; padding: 1rem; background-color: #f0f2f6; border-radius: 8px; margin-bottom: 1rem;">
|
| 150 |
+
<h3>π TechMatrix Solvers</h3>
|
| 151 |
+
<p><em>Innovating Accessible Technology</em></p>
|
| 152 |
+
</div>
|
| 153 |
+
""", unsafe_allow_html=True)
|
| 154 |
|
| 155 |
+
st.sidebar.title('ποΈ Control Panel')
|
| 156 |
|
| 157 |
+
# Team information in sidebar
|
| 158 |
+
with st.sidebar.expander("π¨βπ» Meet Our Team"):
|
| 159 |
+
st.markdown("""
|
| 160 |
+
**TechMatrix Solvers Team:**
|
| 161 |
+
- **Abhay Gupta** - Team Lead π
|
| 162 |
+
- **Kripanshu Gupta** - Backend Dev π»
|
| 163 |
+
- **Dipanshu Patel** - UI/UX Designer π¨
|
| 164 |
+
- **Bhumika Patel** - Deployment π
|
| 165 |
+
|
| 166 |
+
*Shri Ram Group of Institutions*
|
| 167 |
+
""")
|
| 168 |
+
|
| 169 |
+
# Application mode selection
|
| 170 |
+
app_mode = st.sidebar.selectbox(
|
| 171 |
+
'π― Choose Application Mode',
|
| 172 |
+
['π Home & About', 'π₯ Live Translation Demo', 'π System Information'],
|
| 173 |
+
index=0
|
| 174 |
+
)
|
| 175 |
+
|
| 176 |
+
# Utility functions
|
| 177 |
class VideoProbeResult(NamedTuple):
|
| 178 |
"""Structure for video probe results"""
|
| 179 |
return_code: int
|
| 180 |
json: str
|
| 181 |
error: str
|
| 182 |
|
|
|
|
| 183 |
def probe_video_info(file_path) -> VideoProbeResult:
|
| 184 |
+
"""Probe video file for metadata using FFprobe"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
command_array = [
|
| 186 |
+
"ffprobe", "-v", "quiet", "-print_format", "json",
|
| 187 |
+
"-show_format", "-show_streams", file_path
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
]
|
| 189 |
+
try:
|
| 190 |
+
result = subprocess.run(
|
| 191 |
+
command_array,
|
| 192 |
+
stdout=subprocess.PIPE,
|
| 193 |
+
stderr=subprocess.PIPE,
|
| 194 |
+
universal_newlines=True,
|
| 195 |
+
timeout=30
|
| 196 |
+
)
|
| 197 |
+
return VideoProbeResult(
|
| 198 |
+
return_code=result.returncode,
|
| 199 |
+
json=result.stdout,
|
| 200 |
+
error=result.stderr
|
| 201 |
+
)
|
| 202 |
+
except subprocess.TimeoutExpired:
|
| 203 |
+
return VideoProbeResult(1, "", "FFprobe timeout")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
|
|
|
|
| 205 |
@st.cache_data
|
| 206 |
def load_test_data():
|
| 207 |
"""Load test dataset and file information"""
|
| 208 |
+
try:
|
| 209 |
+
with st.spinner("π₯ Loading test data from HuggingFace..."):
|
| 210 |
+
testing_cleaned_path = hf_hub_download(
|
| 211 |
+
repo_id="sunilsarolkar/isl-test-data",
|
| 212 |
+
filename="testing_cleaned.csv",
|
| 213 |
+
repo_type="dataset"
|
| 214 |
+
)
|
| 215 |
+
|
| 216 |
+
test_files_path = hf_hub_download(
|
| 217 |
+
repo_id="sunilsarolkar/isl-test-data",
|
| 218 |
+
filename="test_files.csv",
|
| 219 |
+
repo_type="dataset"
|
| 220 |
+
)
|
| 221 |
+
|
| 222 |
+
testing_df = pd.read_csv(testing_cleaned_path)
|
| 223 |
+
test_files_df = pd.read_csv(test_files_path)
|
| 224 |
+
|
| 225 |
+
return testing_df, test_files_df
|
| 226 |
+
except Exception as e:
|
| 227 |
+
st.error(f"Failed to load test data: {e}")
|
| 228 |
+
return None, None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
+
@st.cache_resource
|
| 231 |
+
def load_translation_model():
|
| 232 |
+
"""Load and configure the LSTM translation model"""
|
| 233 |
+
try:
|
| 234 |
+
with st.spinner("π§ Loading AI translation model..."):
|
| 235 |
+
model = Sequential()
|
| 236 |
+
model.add(Input(shape=((20, 156))))
|
| 237 |
+
model.add(keras.layers.Masking(mask_value=0.))
|
| 238 |
+
model.add(BatchNormalization())
|
| 239 |
+
model.add(Bidirectional(LSTM(32, recurrent_dropout=0.2, return_sequences=True)))
|
| 240 |
+
model.add(Dropout(0.2))
|
| 241 |
+
model.add(Bidirectional(LSTM(32, recurrent_dropout=0.2)))
|
| 242 |
+
model.add(keras.layers.Activation('elu'))
|
| 243 |
+
model.add(Dense(32, use_bias=False, kernel_initializer='he_normal'))
|
| 244 |
+
model.add(BatchNormalization())
|
| 245 |
+
model.add(Dropout(0.2))
|
| 246 |
+
model.add(keras.layers.Activation('elu'))
|
| 247 |
+
model.add(Dense(32, kernel_initializer='he_normal', use_bias=False))
|
| 248 |
+
model.add(BatchNormalization())
|
| 249 |
+
model.add(keras.layers.Activation('elu'))
|
| 250 |
+
model.add(Dropout(0.2))
|
| 251 |
+
model.add(Dense(len(list(expression_mapping.keys())), activation='softmax'))
|
| 252 |
+
|
| 253 |
+
# Download pre-trained weights
|
| 254 |
+
model_file = hf_hub_download(
|
| 255 |
+
repo_id="sunilsarolkar/isl-translation-model",
|
| 256 |
+
filename="isl_model_final.keras"
|
| 257 |
+
)
|
| 258 |
+
model.load_weights(model_file)
|
| 259 |
+
|
| 260 |
+
return model
|
| 261 |
+
except Exception as e:
|
| 262 |
+
st.error(f"Failed to load translation model: {e}")
|
| 263 |
+
return None
|
| 264 |
|
| 265 |
+
# Main application logic
|
| 266 |
+
if app_mode == 'π Home & About':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
|
| 268 |
+
# Project overview
|
| 269 |
+
st.markdown("""
|
| 270 |
+
## π― Project Overview
|
|
|
|
|
|
|
|
|
|
| 271 |
|
| 272 |
+
Welcome to the **ISL Sign Language Translation System** by **TechMatrix Solvers**!
|
| 273 |
+
This cutting-edge application demonstrates real-time Indian Sign Language recognition
|
| 274 |
+
and translation using advanced deep learning techniques.
|
| 275 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
|
| 277 |
+
# Features showcase
|
| 278 |
+
col1, col2, col3 = st.columns(3)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
|
| 280 |
with col1:
|
| 281 |
+
st.markdown("""
|
| 282 |
+
<div class="feature-box">
|
| 283 |
+
<h3>π§ AI-Powered</h3>
|
| 284 |
+
<p>Advanced LSTM networks with 82K+ parameters for accurate sign recognition</p>
|
| 285 |
+
</div>
|
| 286 |
+
""", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
|
| 288 |
with col2:
|
| 289 |
+
st.markdown("""
|
| 290 |
+
<div class="feature-box">
|
| 291 |
+
<h3>β‘ Real-time</h3>
|
| 292 |
+
<p>Live video processing with OpenPose body & hand detection</p>
|
| 293 |
+
</div>
|
| 294 |
+
""", unsafe_allow_html=True)
|
| 295 |
+
|
| 296 |
+
with col3:
|
| 297 |
+
st.markdown("""
|
| 298 |
+
<div class="feature-box">
|
| 299 |
+
<h3>π― Accurate</h3>
|
| 300 |
+
<p>Trained on INCLUDE dataset with 263 words across 15 categories</p>
|
| 301 |
+
</div>
|
| 302 |
+
""", unsafe_allow_html=True)
|
| 303 |
+
|
| 304 |
+
# Technical architecture
|
| 305 |
+
st.markdown("## ποΈ Technical Architecture")
|
| 306 |
|
| 307 |
+
col1, col2 = st.columns(2)
|
| 308 |
+
|
| 309 |
+
with col1:
|
| 310 |
+
st.markdown("""
|
| 311 |
+
### π§ Core Components
|
| 312 |
+
1. **Body Pose Estimation**: 25-point skeletal tracking
|
| 313 |
+
2. **Hand Landmark Detection**: 21-point hand keypoints
|
| 314 |
+
3. **Temporal Modeling**: Bidirectional LSTM networks
|
| 315 |
+
4. **Real-time Processing**: Optimized inference pipeline
|
| 316 |
+
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
|
| 318 |
+
# Display architecture diagram if available
|
| 319 |
+
try:
|
| 320 |
+
st.image("DataPipeline.png", caption="π Data Processing Pipeline", use_column_width=True)
|
| 321 |
+
except:
|
| 322 |
+
st.info("π Architecture diagram will be displayed when available")
|
| 323 |
+
|
| 324 |
+
with col2:
|
| 325 |
+
st.markdown("""
|
| 326 |
+
### π Dataset Statistics
|
| 327 |
+
""")
|
| 328 |
|
| 329 |
+
# Dataset stats
|
| 330 |
+
stats_data = {
|
| 331 |
+
"Metric": ["Categories", "Total Words", "Training Videos", "Avg Videos/Class", "Frame Rate"],
|
| 332 |
+
"Value": ["15", "263", "4,257", "16.3", "25fps"]
|
| 333 |
+
}
|
| 334 |
+
st.table(pd.DataFrame(stats_data))
|
| 335 |
|
| 336 |
+
# Model stats
|
| 337 |
+
st.markdown("""
|
| 338 |
+
### π€ Model Statistics
|
| 339 |
+
- **Architecture**: Bidirectional LSTM
|
| 340 |
+
- **Parameters**: 82,679 (322.96 KB)
|
| 341 |
+
- **Input Features**: 156-dimensional vectors
|
| 342 |
+
- **Temporal Window**: 20 frames
|
| 343 |
+
""")
|
| 344 |
+
|
| 345 |
+
# Team section
|
| 346 |
+
st.markdown("## π₯ TechMatrix Solvers Team")
|
| 347 |
+
|
| 348 |
+
team_data = {
|
| 349 |
+
"Name": ["Abhay Gupta", "Kripanshu Gupta", "Dipanshu Patel", "Bhumika Patel"],
|
| 350 |
+
"Role": ["Team Lead", "Backend Developer", "UI/UX Designer", "Deployment & Presenter"],
|
| 351 |
+
"Email": [
|
| 352 |
+
"contact2abhaygupta6187@gmail.com",
|
| 353 |
+
"guptakripanshu83@gmail.com",
|
| 354 |
+
"dipanshupatel43@gmail.com",
|
| 355 |
+
"bp7249951@gmail.com"
|
| 356 |
+
],
|
| 357 |
+
"Phone": ["8115814535", "7067058400", "9294526404", "9302271422"]
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
st.table(pd.DataFrame(team_data))
|
| 361 |
+
|
| 362 |
+
st.markdown("""
|
| 363 |
+
### π« Institution
|
| 364 |
+
**Shri Ram Group of Institutions**
|
| 365 |
+
|
| 366 |
+
### π Documentation
|
| 367 |
+
For detailed technical documentation, visit our [comprehensive guide](https://docs.google.com/document/d/1mzr2KGHRJT5heUjFF20NQ3Gb89urpjZJ/edit?usp=sharing).
|
| 368 |
+
""")
|
| 369 |
|
| 370 |
+
elif app_mode == 'π₯ Live Translation Demo':
|
| 371 |
+
st.markdown("## π₯ Live ISL Translation Demo")
|
| 372 |
+
|
| 373 |
+
# Load test data
|
| 374 |
+
testing_df, test_files_df = load_test_data()
|
| 375 |
+
|
| 376 |
+
if testing_df is None or test_files_df is None:
|
| 377 |
+
st.error("β Cannot proceed without test data. Please check your internet connection.")
|
| 378 |
+
st.stop()
|
| 379 |
+
|
| 380 |
+
st.success(f"β
Loaded {len(testing_df)} test frames and {len(test_files_df)} video files")
|
| 381 |
+
|
| 382 |
# Video selection interface
|
| 383 |
+
st.markdown("### π Select Test Video")
|
| 384 |
|
| 385 |
+
col1, col2, col3 = st.columns(3)
|
| 386 |
+
|
| 387 |
+
with col1:
|
| 388 |
+
category = st.selectbox(
|
| 389 |
+
'Choose Category',
|
| 390 |
+
sorted(test_files_df['Category'].unique())
|
| 391 |
+
)
|
| 392 |
|
| 393 |
# Filter by category
|
| 394 |
+
category_filtered = test_files_df[test_files_df['Category'] == category]
|
|
|
|
| 395 |
|
| 396 |
+
with col2:
|
| 397 |
+
class_name = st.selectbox(
|
| 398 |
+
'Choose Class',
|
| 399 |
+
sorted(category_filtered['Class'].unique())
|
| 400 |
+
)
|
| 401 |
|
| 402 |
# Filter by class
|
| 403 |
+
class_filtered = category_filtered[category_filtered['Class'] == class_name]
|
| 404 |
+
|
| 405 |
+
with col3:
|
| 406 |
+
filename = st.selectbox(
|
| 407 |
+
'Choose File',
|
| 408 |
+
sorted(class_filtered['Filename'].unique())
|
| 409 |
+
)
|
| 410 |
|
| 411 |
# Display selection info
|
| 412 |
+
st.info(f"π Selected: **{category}** β **{class_name}** β **{filename}**")
|
| 413 |
|
| 414 |
+
# Translation button
|
| 415 |
+
if st.button("π Start ISL Translation", type="primary", use_container_width=True):
|
|
|
|
|
|
|
|
|
|
| 416 |
|
| 417 |
+
# Initialize progress
|
| 418 |
+
progress_bar = st.progress(0)
|
| 419 |
+
status_text = st.empty()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
+
try:
|
| 422 |
+
status_text.text("π Preparing translation model...")
|
| 423 |
+
progress_bar.progress(10)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
|
| 425 |
+
# Load translation model
|
| 426 |
+
translation_model = load_translation_model()
|
| 427 |
+
if translation_model is None:
|
| 428 |
+
st.error("β Failed to load translation model")
|
| 429 |
+
st.stop()
|
| 430 |
+
|
| 431 |
+
progress_bar.progress(30)
|
| 432 |
+
status_text.text("π₯ Downloading test video...")
|
| 433 |
+
|
| 434 |
+
# Download video
|
| 435 |
+
video_file_path = hf_hub_download(
|
| 436 |
+
repo_id="sunilsarolkar/isl-test-data",
|
| 437 |
+
filename=f'test/{category}/{class_name}/{filename}',
|
| 438 |
+
repo_type="dataset"
|
| 439 |
+
)
|
| 440 |
+
|
| 441 |
+
progress_bar.progress(50)
|
| 442 |
+
status_text.text("π¬ Processing video metadata...")
|
| 443 |
+
|
| 444 |
+
# Process video
|
| 445 |
+
if os.path.exists(video_file_path):
|
| 446 |
+
progress_bar.progress(70)
|
| 447 |
+
status_text.text("β¨ Ready for translation!")
|
| 448 |
+
|
| 449 |
+
# Display video info
|
| 450 |
+
st.success("π Video loaded successfully!")
|
| 451 |
+
st.video(video_file_path)
|
| 452 |
+
|
| 453 |
+
# Show translation results placeholder
|
| 454 |
+
st.markdown("### π Translation Results")
|
| 455 |
+
|
| 456 |
+
result_placeholder = st.empty()
|
| 457 |
+
with result_placeholder.container():
|
| 458 |
+
st.info("π Translation would be processed here in the full implementation")
|
| 459 |
+
st.markdown("""
|
| 460 |
+
**Expected Output:**
|
| 461 |
+
- Real-time pose detection
|
| 462 |
+
- Feature extraction from body and hand keypoints
|
| 463 |
+
- LSTM model prediction
|
| 464 |
+
- Sign language translation display
|
| 465 |
+
""")
|
| 466 |
+
|
| 467 |
+
progress_bar.progress(100)
|
| 468 |
+
status_text.text("β
Translation demo completed!")
|
| 469 |
+
else:
|
| 470 |
+
st.error("β Video file not found")
|
| 471 |
+
|
| 472 |
+
except Exception as e:
|
| 473 |
+
st.error(f"β Error during translation: {e}")
|
| 474 |
+
progress_bar.progress(0)
|
| 475 |
+
status_text.text("β Translation failed")
|
| 476 |
|
| 477 |
+
elif app_mode == 'π System Information':
|
| 478 |
+
st.markdown("## π System Information")
|
| 479 |
+
|
| 480 |
+
# System details
|
| 481 |
+
col1, col2 = st.columns(2)
|
| 482 |
+
|
| 483 |
+
with col1:
|
| 484 |
+
st.markdown("### π» Environment")
|
| 485 |
+
st.write(f"**Python Version:** {platform.python_version()}")
|
| 486 |
+
st.write(f"**Platform:** {platform.system()} {platform.release()}")
|
| 487 |
+
st.write(f"**Architecture:** {platform.machine()}")
|
| 488 |
+
st.write(f"**FFmpeg:** {shutil.which('ffmpeg') or 'Not found'}")
|
| 489 |
+
st.write(f"**FFprobe:** {shutil.which('ffprobe') or 'Not found'}")
|
| 490 |
+
|
| 491 |
+
with col2:
|
| 492 |
+
st.markdown("### π Libraries")
|
| 493 |
+
try:
|
| 494 |
+
st.write(f"**OpenCV:** {cv2.__version__}")
|
| 495 |
+
except:
|
| 496 |
+
st.write("**OpenCV:** Not available")
|
| 497 |
|
| 498 |
+
try:
|
| 499 |
+
import torch
|
| 500 |
+
st.write(f"**PyTorch:** {torch.__version__}")
|
| 501 |
+
except:
|
| 502 |
+
st.write("**PyTorch:** Not available")
|
| 503 |
|
| 504 |
+
try:
|
| 505 |
+
st.write(f"**Keras:** {keras.__version__}")
|
| 506 |
+
except:
|
| 507 |
+
st.write("**Keras:** Not available")
|
| 508 |
|
| 509 |
try:
|
| 510 |
+
st.write(f"**NumPy:** {np.__version__}")
|
| 511 |
+
st.write(f"**Pandas:** {pd.__version__}")
|
| 512 |
+
except:
|
| 513 |
+
st.write("**NumPy/Pandas:** Version info not available")
|
| 514 |
+
|
| 515 |
+
# Model information
|
| 516 |
+
st.markdown("### π§ AI Model Details")
|
| 517 |
+
|
| 518 |
+
model_info = {
|
| 519 |
+
"Component": [
|
| 520 |
+
"Translation Model", "Body Pose Model", "Hand Pose Model",
|
| 521 |
+
"Feature Vector", "Temporal Window", "Output Classes"
|
| 522 |
+
],
|
| 523 |
+
"Specification": [
|
| 524 |
+
"Bidirectional LSTM", "OpenPose 25-point", "OpenPose 21-point",
|
| 525 |
+
"156 dimensions", "20 frames", f"{len(expression_mapping)} signs"
|
| 526 |
+
]
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
st.table(pd.DataFrame(model_info))
|
| 530 |
+
|
| 531 |
+
# Performance metrics
|
| 532 |
+
st.markdown("### β‘ Performance Metrics")
|
| 533 |
+
|
| 534 |
+
metrics_col1, metrics_col2, metrics_col3, metrics_col4 = st.columns(4)
|
| 535 |
+
|
| 536 |
+
with metrics_col1:
|
| 537 |
+
st.metric("Model Parameters", "82,679", "Compact & Efficient")
|
| 538 |
+
|
| 539 |
+
with metrics_col2:
|
| 540 |
+
st.metric("Model Size", "322.96 KB", "Lightweight")
|
| 541 |
+
|
| 542 |
+
with metrics_col3:
|
| 543 |
+
st.metric("Input Features", "156", "Rich Feature Set")
|
| 544 |
+
|
| 545 |
+
with metrics_col4:
|
| 546 |
+
st.metric("Sign Classes", len(expression_mapping), "Comprehensive")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 547 |
|
| 548 |
# Footer
|
| 549 |
+
st.markdown("---")
|
| 550 |
+
st.markdown("""
|
| 551 |
+
<div style="text-align: center; color: #666; padding: 2rem;">
|
| 552 |
+
<h4>π TechMatrix Solvers</h4>
|
| 553 |
+
<p><strong>Innovating Accessible Technology Solutions for Everyone</strong></p>
|
| 554 |
+
<p><em>Shri Ram Group of Institutions | Β© 2024</em></p>
|
| 555 |
+
<p>
|
| 556 |
+
<a href="https://docs.google.com/document/d/1mzr2KGHRJT5heUjFF20NQ3Gb89urpjZJ/edit?usp=sharing" target="_blank">π Documentation</a> |
|
| 557 |
+
<a href="mailto:contact2abhaygupta6187@gmail.com">π§ Contact</a> |
|
| 558 |
+
<a href="https://huggingface.co/docs/hub/spaces-config-reference" target="_blank">π€ HF Spaces</a>
|
| 559 |
+
</p>
|
| 560 |
+
</div>
|
| 561 |
+
""", unsafe_allow_html=True)
|