Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import gradio as gr
|
|
5 |
from gtts import gTTS
|
6 |
import io
|
7 |
from pydub import AudioSegment
|
|
|
8 |
|
9 |
# Create audio directory if it doesn't exist
|
10 |
if not os.path.exists('audio'):
|
@@ -46,6 +47,7 @@ def transcribe_audio(audio):
|
|
46 |
|
47 |
# Step 2: Create pronunciation audio for incorrect words
|
48 |
def create_pronunciation_audio(word):
|
|
|
49 |
tts = gTTS(word)
|
50 |
audio_file_path = f"audio/{word}.mp3" # Save the audio to a file
|
51 |
tts.save(audio_file_path)
|
|
|
5 |
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'):
|
|
|
47 |
|
48 |
# Step 2: Create pronunciation audio for incorrect words
|
49 |
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 |
tts.save(audio_file_path)
|