wesam0099 commited on
Commit
035f557
·
verified ·
1 Parent(s): 287b16c

Update src/agent.py

Browse files
Files changed (1) hide show
  1. src/agent.py +18 -28
src/agent.py CHANGED
@@ -1,28 +1,18 @@
1
- # agent.py
2
-
3
- from audio_utils import record_audio, transcribe_audio
4
- from deep_model import predict_accent
5
-
6
- class AccentAgent:
7
- def __init__(self, duration=5):
8
- self.duration = duration
9
- self.audio_path = None
10
- self.transcription = ""
11
- self.accent = ""
12
-
13
- def run(self):
14
- print("[Agent] Starting recording...")
15
- self.audio_path = record_audio(duration=self.duration)
16
- print("[Agent] Audio recorded at:", self.audio_path)
17
-
18
- print("[Agent] Predicting accent...")
19
- self.accent = predict_accent(self.audio_path)
20
-
21
- print("[Agent] Transcribing audio...")
22
- self.transcription = transcribe_audio(self.audio_path)
23
-
24
- return {
25
- "audio_path": self.audio_path,
26
- "accent": self.accent,
27
- "transcription": self.transcription
28
- }
 
1
+ from audio_utils import transcribe_audio
2
+ from deep_model import predict_accent
3
+
4
+ class AccentAgent:
5
+ def __init__(self, audio_path):
6
+ self.audio_path = audio_path
7
+ self.transcription = ""
8
+ self.accent = ""
9
+
10
+ def run(self):
11
+ self.accent = predict_accent(self.audio_path)
12
+ self.transcription = transcribe_audio(self.audio_path)
13
+
14
+ return {
15
+ "audio_path": self.audio_path,
16
+ "accent": self.accent,
17
+ "transcription": self.transcription
18
+ }