mr2along commited on
Commit
94df20a
·
verified ·
1 Parent(s): ae3a313

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -12
app.py CHANGED
@@ -7,7 +7,6 @@ from gtts import gTTS
7
  import io
8
  from pydub import AudioSegment
9
  import time
10
- import epitran
11
  from phonemizer import phonemize
12
 
13
 
@@ -15,12 +14,6 @@ from phonemizer import phonemize
15
  if not os.path.exists('audio'):
16
  os.makedirs('audio')
17
 
18
- # Initialize the epitran object for English
19
- try:
20
- epi=epitran.Epitran('eng-Latn')
21
- except Exception as e:
22
- print(f"Error initializing Epitran: {e}")
23
-
24
  # Step 2: Create pronunciation audio for incorrect words
25
  def upfilepath(local_filename):
26
  ts = time.time()
@@ -78,11 +71,7 @@ def transcribe_audio(audio):
78
 
79
  # Function to get IPA transcription
80
  def ipa_transcription(sentence):
81
- try:
82
- #return epi.transliterate(sentence)
83
- return phonemize("sentence", language='en-us')
84
- except Exception as e:
85
- return f"Error during IPA transcription: {e}"
86
 
87
  # Step 2: Create pronunciation audio for incorrect words (locally)
88
  def create_pronunciation_audio(word):
 
7
  import io
8
  from pydub import AudioSegment
9
  import time
 
10
  from phonemizer import phonemize
11
 
12
 
 
14
  if not os.path.exists('audio'):
15
  os.makedirs('audio')
16
 
 
 
 
 
 
 
17
  # Step 2: Create pronunciation audio for incorrect words
18
  def upfilepath(local_filename):
19
  ts = time.time()
 
71
 
72
  # Function to get IPA transcription
73
  def ipa_transcription(sentence):
74
+ return phonemize("sentence", language='en-us')
 
 
 
 
75
 
76
  # Step 2: Create pronunciation audio for incorrect words (locally)
77
  def create_pronunciation_audio(word):