Oranblock commited on
Commit
e710610
1 Parent(s): f587689

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,8 +3,8 @@ from transformers import pipeline
3
  import json
4
  from difflib import SequenceMatcher
5
 
6
- # Load pre-trained speech-to-text model
7
- recognizer = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h")
8
 
9
  # Load Qur'an verses from JSON file
10
  with open('quran_verses.json', 'r', encoding='utf-8') as f:
@@ -53,7 +53,7 @@ def process_audio(audio):
53
  if audio is None:
54
  return "No audio file provided. Please upload or record an audio."
55
 
56
- # Transcribe the audio
57
  transcription = recognizer(audio)["text"]
58
 
59
  # Find the most similar verse
@@ -90,7 +90,7 @@ iface = gr.Interface(
90
  inputs=gr.Audio(type="filepath"), # You can change this to "numpy" if needed
91
  outputs=gr.Textbox(), # Only use a Textbox to display progress and feedback
92
  title="Qur'an Memorization Helper",
93
- description="Speak a verse, and we'll transcribe it, check your accuracy, and track your progress."
94
  )
95
 
96
  # Launch the app
 
3
  import json
4
  from difflib import SequenceMatcher
5
 
6
+ # Load pre-trained Arabic speech-to-text model
7
+ recognizer = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-large-xlsr-53-arabic")
8
 
9
  # Load Qur'an verses from JSON file
10
  with open('quran_verses.json', 'r', encoding='utf-8') as f:
 
53
  if audio is None:
54
  return "No audio file provided. Please upload or record an audio."
55
 
56
+ # Transcribe the audio using the Arabic model
57
  transcription = recognizer(audio)["text"]
58
 
59
  # Find the most similar verse
 
90
  inputs=gr.Audio(type="filepath"), # You can change this to "numpy" if needed
91
  outputs=gr.Textbox(), # Only use a Textbox to display progress and feedback
92
  title="Qur'an Memorization Helper",
93
+ description="Speak a verse in Arabic, and we'll transcribe it, check your accuracy, and track your progress."
94
  )
95
 
96
  # Launch the app