Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,8 @@ from gtts import gTTS
|
|
6 |
import io
|
7 |
from pydub import AudioSegment
|
8 |
import time
|
9 |
-
|
|
|
10 |
# Create audio directory if it doesn't exist
|
11 |
if not os.path.exists('audio'):
|
12 |
os.makedirs('audio')
|
@@ -50,10 +51,9 @@ def create_pronunciation_audio(word):
|
|
50 |
time.sleep(5) # Chờ 5 giây
|
51 |
tts = gTTS(word)
|
52 |
audio_file_path = f"audio/{word}.mp3" # Save the audio to a file
|
53 |
-
path=os.getenv('code')
|
54 |
tts.save(audio_file_path)
|
55 |
print(f"audio/{word}: {audio_file_path}")
|
56 |
-
return
|
57 |
|
58 |
# Step 3: Compare the transcribed text with the input paragraph
|
59 |
def compare_texts(reference_text, transcribed_text):
|
|
|
6 |
import io
|
7 |
from pydub import AudioSegment
|
8 |
import time
|
9 |
+
print(tempfile.gettempdir())
|
10 |
+
print(gr.set_static_paths)
|
11 |
# Create audio directory if it doesn't exist
|
12 |
if not os.path.exists('audio'):
|
13 |
os.makedirs('audio')
|
|
|
51 |
time.sleep(5) # Chờ 5 giây
|
52 |
tts = gTTS(word)
|
53 |
audio_file_path = f"audio/{word}.mp3" # Save the audio to a file
|
|
|
54 |
tts.save(audio_file_path)
|
55 |
print(f"audio/{word}: {audio_file_path}")
|
56 |
+
return audio_file_path # Return the file path of the saved audio
|
57 |
|
58 |
# Step 3: Compare the transcribed text with the input paragraph
|
59 |
def compare_texts(reference_text, transcribed_text):
|