Spaces:
Running
on
Zero
Running
on
Zero
File size: 25,537 Bytes
25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 02b32bc 25dc731 02b32bc 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 02b32bc 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 02b32bc 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 33e6674 2175de9 5a75be5 33e6674 89f17cd 33e6674 2175de9 5a75be5 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 89f17cd 25dc731 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 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 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 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 |
import gradio as gr
import random
import difflib
import re
import jiwer
import torch
import numpy as np
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
import librosa
import soundfile as sf
from indic_transliteration import sanscript
from indic_transliteration.sanscript import transliterate
import warnings
import spaces
warnings.filterwarnings("ignore")
# Try to import whisper_jax, fallback to transformers if not available
try:
from whisper_jax import FlaxWhisperPipeline
import jax.numpy as jnp
WHISPER_JAX_AVAILABLE = True
print("🚀 Using JAX-optimized IndicWhisper (70x faster!)")
except ImportError:
WHISPER_JAX_AVAILABLE = False
print("⚠️ whisper_jax not available, using transformers fallback")
# ---------------- CONFIG ---------------- #
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
print(f"🔧 Using device: {DEVICE}")
LANG_CODES = {
"English": "en",
"Tamil": "ta",
"Malayalam": "ml"
}
# SOTA IndicWhisper model - one model for all languages!
INDICWHISPER_MODEL = "parthiv11/indic_whisper_nodcil"
# Fallback models if IndicWhisper fails
FALLBACK_MODELS = {
"English": "openai/whisper-base.en",
"Tamil": "vasista22/whisper-tamil-large-v2",
"Malayalam": "thennal/whisper-medium-ml"
}
LANG_PRIMERS = {
"English": ("Transcribe in English.",
"Write only in English. Example: This is an English sentence."),
"Tamil": ("தமிழில் எழுதுக.",
"தமிழ் எழுத்துக்களில் மட்டும் எழுதவும். உதாரணம்: இது ஒரு தமிழ் வாக்கியம்."),
"Malayalam": ("മലയാളത്തിൽ എഴുതുക.",
"മലയാള ലിപിയിൽ മാത്രം എഴുതുക. ഉദാഹരണം: ഇതൊരു മലയാള വാക്യമാണ്.")
}
SCRIPT_PATTERNS = {
"Tamil": re.compile(r"[-]"),
"Malayalam": re.compile(r"[ഀ-ൿ]"),
"English": re.compile(r"[A-Za-z]")
}
SENTENCE_BANK = {
"English": [
"The sun sets over the beautiful horizon.",
"Learning new languages opens many doors.",
"I enjoy reading books in the evening.",
"Technology has changed our daily lives.",
"Music brings people together across cultures.",
"Education is the key to a bright future.",
"The flowers bloom beautifully in spring.",
"Hard work always pays off in the end."
],
"Tamil": [
"இன்று நல்ல வானிலை உள்ளது.",
"நான் தமிழ் கற்றுக்கொண்டு இருக்கிறேன்.",
"எனக்கு புத்தகம் படிக்க விருப்பம்.",
"தமிழ் மொழி மிகவும் அழகானது.",
"குடும்பத்துடன் நேரம் செலவிடுவது முக்கியம்.",
"கல்வி நமது எதிர்காலத்தின் திறவுகோல்.",
"பறவைகள் காலையில் இனிமையாக பாடுகின்றன.",
"உழைப்பு எப்போதும் வெற்றியைத் தரும்."
],
"Malayalam": [
"എനിക്ക് മലയാളം വളരെ ഇഷ്ടമാണ്.",
"ഇന്ന് മഴപെയ്യുന്നു.",
"ഞാൻ പുസ്തകം വായിക്കുന്നു.",
"കേരളത്തിന്റെ പ്രകൃതി സുന്ദരമാണ്.",
"വിദ്യാഭ്യാസം ജീവിതത്തിൽ പ്രധാനമാണ്.",
"സംഗീതം മനസ്സിന് സന്തോഷം നൽകുന്നു.",
"കുടുംബസമയം വളരെ വിലപ്പെട്ടതാണ്.",
"കഠിനാധ്വാനം എപ്പോഴും ഫലം നൽകും."
]
}
# ---------------- MODEL CACHE ---------------- #
indicwhisper_pipeline = None
fallback_models = {}
@spaces.GPU
def load_indicwhisper():
"""Load the SOTA IndicWhisper model"""
global indicwhisper_pipeline
if indicwhisper_pipeline is None:
try:
print(f"🔄 Loading SOTA IndicWhisper: {INDICWHISPER_MODEL}")
if WHISPER_JAX_AVAILABLE:
# Use JAX-optimized version (70x faster!)
indicwhisper_pipeline = FlaxWhisperPipeline(
INDICWHISPER_MODEL,
dtype=jnp.bfloat16,
batch_size=1
)
print("✅ IndicWhisper loaded with JAX optimization (70x faster!)")
else:
# Fallback to transformers if whisper_jax not available
from transformers import pipeline
indicwhisper_pipeline = pipeline(
"automatic-speech-recognition",
model=INDICWHISPER_MODEL,
device=DEVICE if DEVICE == "cuda" else -1
)
print("✅ IndicWhisper loaded with transformers (fallback mode)")
except Exception as e:
print(f"❌ Failed to load IndicWhisper: {e}")
indicwhisper_pipeline = None
raise Exception(f"Could not load IndicWhisper model: {str(e)}")
return indicwhisper_pipeline
@spaces.GPU
def load_fallback_model(language):
"""Load fallback model if IndicWhisper fails"""
if language not in fallback_models:
model_name = FALLBACK_MODELS[language]
print(f"🔄 Loading fallback model for {language}: {model_name}")
try:
processor = AutoProcessor.from_pretrained(model_name)
model = AutoModelForSpeechSeq2Seq.from_pretrained(
model_name,
torch_dtype=torch.float16 if DEVICE == "cuda" else torch.float32,
low_cpu_mem_usage=True,
use_safetensors=True
).to(DEVICE)
fallback_models[language] = {"processor": processor, "model": model, "model_name": model_name}
print(f"✅ Fallback model loaded for {language}")
except Exception as e:
print(f"❌ Failed to load fallback {model_name}: {e}")
raise Exception(f"Could not load fallback {language} model")
return fallback_models[language]
# ---------------- HELPERS ---------------- #
def get_random_sentence(language_choice):
"""Get random sentence for practice"""
return random.choice(SENTENCE_BANK[language_choice])
def is_script(text, lang_name):
"""Check if text is in expected script"""
pattern = SCRIPT_PATTERNS.get(lang_name)
if not pattern:
return True
return bool(pattern.search(text))
def transliterate_to_hk(text, lang_choice):
"""Transliterate Indic text to Harvard-Kyoto"""
mapping = {
"Tamil": sanscript.TAMIL,
"Malayalam": sanscript.MALAYALAM,
"English": None
}
script = mapping.get(lang_choice)
if script and is_script(text, lang_choice):
try:
return transliterate(text, script, sanscript.HK)
except Exception as e:
print(f"Transliteration error: {e}")
return text
return text
def preprocess_audio(audio_path, target_sr=16000):
"""Preprocess audio for ASR"""
try:
# Load audio
audio, sr = librosa.load(audio_path, sr=target_sr)
# Normalize audio
if np.max(np.abs(audio)) > 0:
audio = audio / np.max(np.abs(audio))
# Remove silence from beginning and end
audio, _ = librosa.effects.trim(audio, top_db=20)
# Ensure minimum length
if len(audio) < target_sr * 0.1: # Less than 0.1 seconds
return None, None
return audio, target_sr
except Exception as e:
print(f"Audio preprocessing error: {e}")
return None, None
@spaces.GPU
def transcribe_with_indicwhisper(audio_path, language):
"""Transcribe using SOTA IndicWhisper"""
try:
pipeline = load_indicwhisper()
if WHISPER_JAX_AVAILABLE and hasattr(pipeline, '__call__'):
# JAX-optimized version
result = pipeline(audio_path)
if isinstance(result, dict) and 'text' in result:
return result['text'].strip()
elif isinstance(result, str):
return result.strip()
else:
return str(result).strip()
else:
# Transformers fallback
result = pipeline(audio_path)
return result.get('text', '').strip()
except Exception as e:
print(f"IndicWhisper transcription error: {e}")
raise e
@spaces.GPU
def transcribe_with_fallback(audio_path, language):
"""Transcribe using fallback models"""
try:
components = load_fallback_model(language)
processor = components["processor"]
model = components["model"]
# Preprocess audio
audio, sr = preprocess_audio(audio_path)
if audio is None:
return "Error: Audio too short or could not be processed"
# Prepare inputs
inputs = processor(
audio,
sampling_rate=sr,
return_tensors="pt",
padding=True
)
# Move to device
input_features = inputs.input_features.to(DEVICE)
# Generate transcription
with torch.no_grad():
generate_kwargs = {
"input_features": input_features,
"max_length": 200,
"num_beams": 3,
"do_sample": False
}
# Language forcing for non-English
if language != "English":
lang_code = LANG_CODES.get(language, "en")
try:
if hasattr(processor, 'get_decoder_prompt_ids'):
forced_decoder_ids = processor.get_decoder_prompt_ids(
language=lang_code,
task="transcribe"
)
generate_kwargs["forced_decoder_ids"] = forced_decoder_ids
except Exception as e:
print(f"⚠️ Language forcing failed: {e}")
predicted_ids = model.generate(**generate_kwargs)
# Decode
transcription = processor.batch_decode(
predicted_ids,
skip_special_tokens=True,
clean_up_tokenization_spaces=True
)[0]
return transcription.strip() or "(No transcription generated)"
except Exception as e:
print(f"Fallback transcription error: {e}")
return f"Error: {str(e)[:150]}..."
@spaces.GPU
def transcribe_audio(audio_path, language, initial_prompt="", use_fallback=False):
"""Main transcription function with IndicWhisper + fallback"""
try:
if use_fallback:
print(f"🔄 Using fallback model for {language}")
return transcribe_with_fallback(audio_path, language)
else:
print(f"🔄 Using SOTA IndicWhisper for {language}")
return transcribe_with_indicwhisper(audio_path, language)
except Exception as e:
print(f"Transcription failed, trying fallback: {e}")
if not use_fallback:
# Retry with fallback
return transcribe_audio(audio_path, language, initial_prompt, use_fallback=True)
else:
return f"Error: All transcription methods failed - {str(e)[:100]}"
def highlight_differences(ref, hyp):
"""Highlight word-level differences with better styling"""
if not ref.strip() or not hyp.strip():
return "No text to compare"
ref_words = ref.strip().split()
hyp_words = hyp.strip().split()
sm = difflib.SequenceMatcher(None, ref_words, hyp_words)
out_html = []
for tag, i1, i2, j1, j2 in sm.get_opcodes():
if tag == 'equal':
out_html.extend([f"<span style='color:green; font-weight:bold; background-color:#e8f5e8; padding:2px 4px; margin:1px; border-radius:3px;'>{w}</span>" for w in ref_words[i1:i2]])
elif tag == 'replace':
out_html.extend([f"<span style='color:red; text-decoration:line-through; background-color:#ffe8e8; padding:2px 4px; margin:1px; border-radius:3px;'>{w}</span>" for w in ref_words[i1:i2]])
out_html.extend([f"<span style='color:orange; font-weight:bold; background-color:#fff3cd; padding:2px 4px; margin:1px; border-radius:3px;'>→{w}</span>" for w in hyp_words[j1:j2]])
elif tag == 'delete':
out_html.extend([f"<span style='color:red; text-decoration:line-through; background-color:#ffe8e8; padding:2px 4px; margin:1px; border-radius:3px;'>{w}</span>" for w in ref_words[i1:i2]])
elif tag == 'insert':
out_html.extend([f"<span style='color:orange; font-weight:bold; background-color:#fff3cd; padding:2px 4px; margin:1px; border-radius:3px;'>+{w}</span>" for w in hyp_words[j1:j2]])
return " ".join(out_html)
def char_level_highlight(ref, hyp):
"""Highlight character-level differences"""
if not ref.strip() or not hyp.strip():
return "No text to compare"
sm = difflib.SequenceMatcher(None, list(ref), list(hyp))
out = []
for tag, i1, i2, j1, j2 in sm.get_opcodes():
if tag == 'equal':
out.extend([f"<span style='color:green; background-color:#e8f5e8;'>{c}</span>" for c in ref[i1:i2]])
elif tag in ('replace', 'delete'):
out.extend([f"<span style='color:red; text-decoration:underline; background-color:#ffe8e8; font-weight:bold;'>{c}</span>" for c in ref[i1:i2]])
elif tag == 'insert':
out.extend([f"<span style='color:orange; background-color:#fff3cd; font-weight:bold;'>{c}</span>" for c in hyp[j1:j2]])
return "".join(out)
def get_pronunciation_score(wer_val, cer_val):
"""Calculate pronunciation score and feedback"""
# Weight WER more heavily than CER
combined_score = (wer_val * 0.7) + (cer_val * 0.3)
if combined_score <= 0.1:
return "🏆 Excellent! (90%+)", "Your pronunciation is outstanding!"
elif combined_score <= 0.2:
return "🎉 Very Good! (80-90%)", "Great pronunciation with minor areas for improvement."
elif combined_score <= 0.4:
return "👍 Good! (60-80%)", "Good effort! Keep practicing for better accuracy."
elif combined_score <= 0.6:
return "📚 Needs Practice (40-60%)", "Focus on clearer pronunciation of highlighted words."
else:
return "💪 Keep Trying! (<40%)", "Don't give up! Practice makes perfect."
# ---------------- MAIN FUNCTION ---------------- #
@spaces.GPU
def compare_pronunciation(audio, language_choice, intended_sentence):
"""Main function to compare pronunciation using SOTA IndicWhisper"""
print(f"🔍 Starting SOTA analysis with language: {language_choice}")
print(f"📝 Audio file: {audio}")
print(f"🎯 Intended sentence: {intended_sentence}")
if audio is None:
print("❌ No audio provided")
return ("❌ Please record audio first.", "", "", "", "", "", "", "")
if not intended_sentence.strip():
print("❌ No intended sentence")
return ("❌ Please generate a practice sentence first.", "", "", "", "", "", "", "")
try:
print(f"🔍 Analyzing pronunciation using SOTA IndicWhisper...")
# Pass 1: SOTA IndicWhisper transcription
print("🔄 Starting Pass 1: SOTA IndicWhisper transcription...")
actual_text = transcribe_audio(audio, language_choice, use_fallback=False)
print(f"✅ SOTA Pass 1 result: {actual_text}")
# Pass 2: Fallback model for comparison
print("🔄 Starting Pass 2: Fallback model transcription...")
fallback_text = transcribe_audio(audio, language_choice, use_fallback=True)
print(f"✅ Fallback Pass 2 result: {fallback_text}")
# Handle transcription errors
if actual_text.startswith("Error:"):
print(f"❌ Transcription error: {actual_text}")
return (f"❌ {actual_text}", "", "", "", "", "", "", "")
# Calculate error metrics using the better transcription
try:
print("🔄 Calculating error metrics...")
wer_val = jiwer.wer(intended_sentence, actual_text)
cer_val = jiwer.cer(intended_sentence, actual_text)
print(f"✅ WER: {wer_val:.3f}, CER: {cer_val:.3f}")
except Exception as e:
print(f"❌ Error calculating metrics: {e}")
wer_val, cer_val = 1.0, 1.0
# Get pronunciation score and feedback
score_text, feedback = get_pronunciation_score(wer_val, cer_val)
print(f"✅ Score: {score_text}")
# Transliterations
print("🔄 Generating transliterations...")
actual_hk = transliterate_to_hk(actual_text, language_choice)
target_hk = transliterate_to_hk(intended_sentence, language_choice)
# Handle script mismatches
if not is_script(actual_text, language_choice) and language_choice != "English":
actual_hk = f"⚠️ Expected {language_choice} script, got mixed/other script"
# Visual feedback
print("🔄 Generating visual feedback...")
diff_html = highlight_differences(intended_sentence, actual_text)
char_html = char_level_highlight(intended_sentence, actual_text)
# Status message with SOTA info
status = f"✅ SOTA Analysis Complete - {score_text}\n💬 {feedback}\n🚀 Powered by IndicWhisper (AI4Bharat SOTA)"
print(f"✅ SOTA analysis completed successfully")
return (
status,
actual_text or "(No transcription)",
fallback_text or "(No fallback transcription)",
f"{wer_val:.3f} ({(1-wer_val)*100:.1f}% word accuracy)",
f"{cer_val:.3f} ({(1-cer_val)*100:.1f}% character accuracy)",
diff_html,
char_html,
f"🎯 Target: {intended_sentence}"
)
except Exception as e:
error_msg = f"❌ Analysis Error: {str(e)[:200]}"
print(f"❌ FATAL ERROR: {e}")
import traceback
traceback.print_exc()
return (error_msg, str(e), "", "", "", "", "", "")
# ---------------- UI ---------------- #
def create_interface():
with gr.Blocks(title="🎙️ SOTA Multilingual Pronunciation Trainer") as demo:
gr.Markdown("""
# 🎙️ SOTA Multilingual Pronunciation Trainer
**Practice pronunciation in Tamil, Malayalam & English** using **IndicWhisper - the State-of-the-Art ASR model**!
### 🏆 **Powered by IndicWhisper:**
- **SOTA Performance:** Lowest WER on 39/59 benchmarks for Indian languages
- **JAX-Optimized:** 70x faster than standard implementations
- **AI4Bharat Research:** Built by IIT Madras for maximum accuracy
### 📋 How to Use:
1. **Select** your target language 🌍
2. **Generate** a practice sentence 🎲
3. **Record** yourself reading it aloud 🎤
4. **Get** detailed feedback with SOTA-level accuracy 📊
### 🎯 Features:
- **SOTA + Fallback analysis** for comprehensive assessment
- **Visual highlighting** of pronunciation errors
- **Romanization** for Indic scripts
- **Advanced metrics** (Word & Character accuracy)
""")
with gr.Row():
with gr.Column(scale=3):
lang_choice = gr.Dropdown(
choices=list(LANG_CODES.keys()),
value="Tamil",
label="🌍 Select Language"
)
with gr.Column(scale=1):
gen_btn = gr.Button("🎲 Generate Sentence", variant="primary")
intended_display = gr.Textbox(
label="📝 Practice Sentence (Read this aloud)",
placeholder="Click 'Generate Sentence' to get started...",
interactive=False,
lines=3
)
audio_input = gr.Audio(
sources=["microphone", "upload"],
type="filepath",
label="🎤 Record Your Pronunciation"
)
analyze_btn = gr.Button("🔍 Analyze with SOTA IndicWhisper", variant="primary")
status_output = gr.Textbox(
label="📊 SOTA Analysis Results",
interactive=False,
lines=4
)
with gr.Row():
with gr.Column():
pass1_out = gr.Textbox(
label="🏆 SOTA IndicWhisper Output",
interactive=False,
lines=2
)
wer_out = gr.Textbox(
label="📈 Word Accuracy",
interactive=False
)
with gr.Column():
pass2_out = gr.Textbox(
label="🔧 Fallback Model Comparison",
interactive=False,
lines=2
)
cer_out = gr.Textbox(
label="📊 Character Accuracy",
interactive=False
)
with gr.Accordion("📝 Detailed Visual Feedback", open=True):
gr.Markdown("""
### 🎨 Color Guide:
- 🟢 **Green**: Correctly pronounced words/characters
- 🔴 **Red**: Missing or mispronounced (strikethrough)
- 🟠 **Orange**: Extra words or substitutions
""")
diff_html_box = gr.HTML(
label="🔍 Word-Level Analysis",
show_label=True
)
char_html_box = gr.HTML(
label="🔤 Character-Level Analysis",
show_label=True
)
target_display = gr.Textbox(
label="🎯 Reference Text",
interactive=False,
visible=False
)
# Event handlers for buttons
gen_btn.click(
fn=get_random_sentence,
inputs=[lang_choice],
outputs=[intended_display]
)
analyze_btn.click(
fn=compare_pronunciation,
inputs=[audio_input, lang_choice, intended_display],
outputs=[
status_output, # status
pass1_out, # SOTA IndicWhisper
pass2_out, # fallback comparison
wer_out, # wer formatted
cer_out, # cer formatted
diff_html_box, # diff_html
char_html_box, # char_html
target_display # target_display
]
)
# Auto-generate sentence on language change
lang_choice.change(
fn=get_random_sentence,
inputs=[lang_choice],
outputs=[intended_display]
)
# Footer
gr.Markdown("""
---
### 🏆 **SOTA Technology Stack:**
- **Primary ASR**: IndicWhisper (AI4Bharat/IIT Madras) - SOTA for Indian languages
- **JAX Optimization**: 70x speed improvement with `parthiv11/indic_whisper_nodcil`
- **Fallback Models**: Specialized fine-tuned models for comparison
- **Benchmark Performance**: Lowest WER on 39/59 Vistaar benchmarks
- **Training Data**: 10,700+ hours across 12 Indian languages
### 🔧 **Technical Details:**
- **Metrics**: WER (Word Error Rate) and CER (Character Error Rate)
- **Transliteration**: Harvard-Kyoto system for Indic scripts
- **Analysis**: SOTA + Fallback comparison for comprehensive feedback
- **Languages**: English, Tamil, and Malayalam with SOTA accuracy
**Note**: Using the most advanced ASR models available for Indian language pronunciation assessment.
**Research**: Based on "Vistaar: Diverse Benchmarks and Training Sets for Indian Language ASR" (AI4Bharat, 2023)
""")
return demo
# ---------------- LAUNCH ---------------- #
if __name__ == "__main__":
print("🚀 Starting SOTA Multilingual Pronunciation Trainer...")
print(f"🔧 Device: {DEVICE}")
print(f"🔧 PyTorch version: {torch.__version__}")
print("🏆 Using IndicWhisper - State-of-the-Art for Indian Languages")
print("⚡ JAX optimization: 70x speed improvement available")
print("📊 SOTA Performance: Lowest WER on 39/59 benchmarks")
print("🎮 GPU functions decorated with @spaces.GPU for HuggingFace Spaces")
demo = create_interface()
demo.launch(
share=True,
show_error=True,
server_name="0.0.0.0",
server_port=7860
) |