sudhanm commited on
Commit
e82b46f
·
verified ·
1 Parent(s): f1aa111

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -10,7 +10,7 @@ from transformers import pipeline # only pipeline is needed for TTS
10
 
11
  # ---------------- CONFIG ---------------- #
12
  MODEL_NAME = "large-v2"
13
- DEVICE = "cpu"
14
 
15
  LANG_CODES = {
16
  "English": "en", "Tamil": "ta", "Malayalam": "ml",
@@ -145,7 +145,7 @@ def compare_pronunciation(audio, language_choice, intended_sentence,
145
  actual_text = transcribe_once(audio, lang_code, primer_weak,
146
  pass1_beam, pass1_temp, pass1_condition)
147
 
148
- # Pass 2 (fixed)
149
  strict_prompt = f"{primer_strong}\nTarget: {intended_sentence}"
150
  corrected_text = transcribe_once(audio, lang_code, strict_prompt,
151
  beam_size=5, temperature=0.0, condition_on_previous_text=False)
@@ -163,7 +163,7 @@ def compare_pronunciation(audio, language_choice, intended_sentence,
163
  diff_html = highlight_differences(intended_sentence, actual_text)
164
  char_html = char_level_highlight(intended_sentence, actual_text)
165
 
166
- # TTS for intended & pass1
167
  tts_intended = synthesize_tts(intended_sentence, language_choice)
168
  tts_pass1 = synthesize_tts(actual_text, language_choice)
169
 
 
10
 
11
  # ---------------- CONFIG ---------------- #
12
  MODEL_NAME = "large-v2"
13
+ DEVICE = "cpu" # change to "cuda" if GPU available in Space
14
 
15
  LANG_CODES = {
16
  "English": "en", "Tamil": "ta", "Malayalam": "ml",
 
145
  actual_text = transcribe_once(audio, lang_code, primer_weak,
146
  pass1_beam, pass1_temp, pass1_condition)
147
 
148
+ # Pass 2 (fixed best-known defaults)
149
  strict_prompt = f"{primer_strong}\nTarget: {intended_sentence}"
150
  corrected_text = transcribe_once(audio, lang_code, strict_prompt,
151
  beam_size=5, temperature=0.0, condition_on_previous_text=False)
 
163
  diff_html = highlight_differences(intended_sentence, actual_text)
164
  char_html = char_level_highlight(intended_sentence, actual_text)
165
 
166
+ # TTS
167
  tts_intended = synthesize_tts(intended_sentence, language_choice)
168
  tts_pass1 = synthesize_tts(actual_text, language_choice)
169