|
|
|
|
|
from audio_utils import record_audio, transcribe_audio
|
|
from deep_model import predict_accent
|
|
|
|
class AccentAgent:
|
|
def __init__(self, duration=5):
|
|
self.duration = duration
|
|
self.audio_path = None
|
|
self.transcription = ""
|
|
self.accent = ""
|
|
|
|
def run(self):
|
|
print("[Agent] Starting recording...")
|
|
self.audio_path = record_audio(duration=self.duration)
|
|
print("[Agent] Audio recorded at:", self.audio_path)
|
|
|
|
print("[Agent] Predicting accent...")
|
|
self.accent = predict_accent(self.audio_path)
|
|
|
|
print("[Agent] Transcribing audio...")
|
|
self.transcription = transcribe_audio(self.audio_path)
|
|
|
|
return {
|
|
"audio_path": self.audio_path,
|
|
"accent": self.accent,
|
|
"transcription": self.transcription
|
|
}
|
|
|