NLPV commited on
Commit
092c4c2
·
verified ·
1 Parent(s): e11e8a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -55,6 +55,8 @@ def compare_hindi_sentences(expected, transcribed):
55
 
56
  def calculate_accuracy(expected, transcribed):
57
  expected_words = expected.strip().split()
 
 
58
  transcribed_words = transcribed.strip().split()
59
  matcher = difflib.SequenceMatcher(None, transcribed_words, expected_words)
60
  correct = 0
@@ -74,8 +76,6 @@ def transcribe_audio(audio_path, original_text):
74
  errors = compare_hindi_sentences(original_text, transcription)
75
  df_errors = pd.DataFrame(errors, columns=["बिगड़ा हुआ शब्द", "संभावित सही शब्द", "गलती का प्रकार"])
76
  # Speaking speed
77
- transcription = transcription.translate(str.maketrans('', '', string.punctuation))
78
- transcription = transcription.replace(',',' ')
79
  transcribed_words = transcription.strip().split()
80
  duration = result['segments'][-1]['end'] if result.get('segments') else 1.0
81
  speed = round(len(transcribed_words) / duration, 2) if duration > 0 else 0
 
55
 
56
  def calculate_accuracy(expected, transcribed):
57
  expected_words = expected.strip().split()
58
+ transcribed = transcribed.translate(str.maketrans('', '', string.punctuation))
59
+ transcribed = transcribed.replace(',',' ')
60
  transcribed_words = transcribed.strip().split()
61
  matcher = difflib.SequenceMatcher(None, transcribed_words, expected_words)
62
  correct = 0
 
76
  errors = compare_hindi_sentences(original_text, transcription)
77
  df_errors = pd.DataFrame(errors, columns=["बिगड़ा हुआ शब्द", "संभावित सही शब्द", "गलती का प्रकार"])
78
  # Speaking speed
 
 
79
  transcribed_words = transcription.strip().split()
80
  duration = result['segments'][-1]['end'] if result.get('segments') else 1.0
81
  speed = round(len(transcribed_words) / duration, 2) if duration > 0 else 0