Spaces:
Running
Running
Commit
·
58f4663
1
Parent(s):
109bd2f
Initial
Browse files
app.py
CHANGED
@@ -33,7 +33,8 @@ async def main(audio_file_path: str):
|
|
33 |
|
34 |
Returns
|
35 |
-------
|
36 |
-
|
|
|
37 |
"""
|
38 |
# Paths
|
39 |
config_nemo = "config/nemo/diar_infer_telephonic.yaml"
|
@@ -73,7 +74,7 @@ async def main(audio_file_path: str):
|
|
73 |
# Step 1: Detect Dialogue
|
74 |
has_dialogue = dialogue_detector.process(audio_file_path)
|
75 |
if not has_dialogue:
|
76 |
-
return
|
77 |
|
78 |
# Step 2: Speech Enhancement
|
79 |
audio_path = enhancer.enhance_audio(
|
@@ -167,7 +168,7 @@ async def main(audio_file_path: str):
|
|
167 |
)
|
168 |
annotator.add_topic(topic_result)
|
169 |
|
170 |
-
#
|
171 |
props = audio_feature_extractor.properties()
|
172 |
|
173 |
(
|
@@ -195,7 +196,7 @@ async def main(audio_file_path: str):
|
|
195 |
|
196 |
final_output = annotator.finalize()
|
197 |
|
198 |
-
# Step 16:
|
199 |
stats = SilenceStats.from_segments(final_output['ssm'])
|
200 |
t_std = stats.threshold_std(factor=0.99)
|
201 |
final_output["silence"] = t_std
|
@@ -269,6 +270,7 @@ async def main(audio_file_path: str):
|
|
269 |
# Step 18: Clean Up
|
270 |
cleaner.cleanup(temp_dir, audio_file_path)
|
271 |
|
|
|
272 |
|
273 |
async def process(path: str):
|
274 |
"""
|
@@ -289,4 +291,5 @@ async def process(path: str):
|
|
289 |
|
290 |
if __name__ == "__main__":
|
291 |
directory_to_watch = ".data/input"
|
292 |
-
Watcher.start_watcher(directory_to_watch, process)
|
|
|
|
33 |
|
34 |
Returns
|
35 |
-------
|
36 |
+
dict
|
37 |
+
final_output
|
38 |
"""
|
39 |
# Paths
|
40 |
config_nemo = "config/nemo/diar_infer_telephonic.yaml"
|
|
|
74 |
# Step 1: Detect Dialogue
|
75 |
has_dialogue = dialogue_detector.process(audio_file_path)
|
76 |
if not has_dialogue:
|
77 |
+
return {"error": "No dialogue detected in the audio file."}
|
78 |
|
79 |
# Step 2: Speech Enhancement
|
80 |
audio_path = enhancer.enhance_audio(
|
|
|
168 |
)
|
169 |
annotator.add_topic(topic_result)
|
170 |
|
171 |
+
# Step 15: File/Audio Feature Extraction
|
172 |
props = audio_feature_extractor.properties()
|
173 |
|
174 |
(
|
|
|
196 |
|
197 |
final_output = annotator.finalize()
|
198 |
|
199 |
+
# Step 16: Total Silence Calculation
|
200 |
stats = SilenceStats.from_segments(final_output['ssm'])
|
201 |
t_std = stats.threshold_std(factor=0.99)
|
202 |
final_output["silence"] = t_std
|
|
|
270 |
# Step 18: Clean Up
|
271 |
cleaner.cleanup(temp_dir, audio_file_path)
|
272 |
|
273 |
+
return final_output
|
274 |
|
275 |
async def process(path: str):
|
276 |
"""
|
|
|
291 |
|
292 |
if __name__ == "__main__":
|
293 |
directory_to_watch = ".data/input"
|
294 |
+
# Watcher.start_watcher(directory_to_watch, process)
|
295 |
+
pass
|