Non-Functional:
There is no storage requirement for this problem. We will serve ~60 requests / sec, which will put load on the translation model but not a db. There is no concept of a db write.
POST translate text:
/api/
create text translation request body:
POST translate speech:
/api/
create speech translation request body:
N/A
There are two components required by both translation flows (text and speech): language detection and translation.
Language detection will use an underlying, pre-trained NLP model. The input to this model will be text, the output will be the detected language. There may be a pre-defined list of supported languages.
Translation will also use an underlying, pre-trained NLP model. The input to this model will be text, source language, and desired language; and the output will be text. There may be a pre-defined list of supported languages.
The text translation flow will call these two components sequentially. The speech translation flow will require two more initial components:
/api/
/api/
Language detection: if the text file is large, it may not be effective to run language detection on the entire input. Instead, maybe we can define a minimum text requirement to effectively determine language and pass in a snippet of that size.
Speech -> text: this may be a slow process, especially on a large audio file. Maybe we can run speech -> text as an async process and inform the user when their translation is ready using webhooks or websockets.
Explain any trade offs you have made and why you made certain tech choices...
Translation requests could fluctuate based on different factors such as geographical regions, time zones, and user demand spikes due to events like international conferences or webinars.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?