Skip to content
Snippets Groups Projects
Unverified Commit f9d36ebb authored by Marcin Wątroba's avatar Marcin Wątroba
Browse files

Add words_time_alignment to asr

parent 694c20b0
No related branches found
No related tags found
1 merge request!10Feature/add auth asr service
This commit is part of merge request !10. Comments created here will be created in the context of that merge request.
No preview for this file type
......@@ -36,13 +36,19 @@ class AsrBaseProcessor(ABC):
try:
transcription = self.process_asr(file_path)
os.remove(file_path)
result_object = jsonify(
{"transcription": transcription.words, "full_text": transcription.full_text}
)
response_dict = {
"transcription": transcription.words,
"full_text": transcription.full_text,
"words_time_alignment": transcription.words_time_alignment
}
result_object = jsonify(response_dict)
except Exception as exception:
print(exception)
traceback.print_exc()
result_object = jsonify({"error": "Error on asr processing"})
finally:
if os.path.isfile(file_path):
os.remove(file_path)
else:
result_object = jsonify({"error": "Error on asr processing"})
return result_object
......
from dataclasses import dataclass
from typing import List
from typing import List, Optional
@dataclass(frozen=True)
class WordTimeAlignment:
start_ms: float
end_ms: float
@dataclass(frozen=True)
class AsrResult:
words: List[str]
full_text: str
words_time_alignment: Optional[List[WordTimeAlignment]]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment