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
Branches
1 merge request!10Feature/add auth asr service
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% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment