Design an image-to-multilanguage translator
AxonSoftware Engineer · Technical ScreenLast updated
This question tests the ability to design a distributed, scalable image processing pipeline that integrates OCR with translation services while addressing latency, storage, and reliability concerns.
Problem Statement
Design a service that allows users to upload an image containing text (e.g., a menu or a sign) and receive the text translated into their preferred language. The system must support thousands of concurrent requests, provide low-latency responses, and handle images in various formats (JPEG, PNG, HEIC) up to 10MB each.
Functional Requirements
- Users can upload an image and specify a target language.
- The system returns the extracted text and the translated version.
- The system supports a set of 50+ target languages.
Non-Functional Requirements
- Latency: The initial response for text extraction should be fast; translation can be processed as a secondary step.
- Reliability: Handle service failures in third-party OCR or translation APIs.
- Scalability: The system must scale based on traffic spikes (e.g., travel season).
- Privacy: Ensure user images are handled securely and deleted or anonymized according to policy.
Deliverables
- High-level architecture diagram (or component description).
- API design (endpoints and request/response payloads).
- Data model for storing user requests and metadata.
- Strategy for handling long-running processing tasks and asynchronous communication.
- Trade-offs between choosing an off-the-shelf cloud OCR API vs. a self-hosted ML model.
Hints
Hint 1
Consider using an asynchronous task queue or message broker to decouple image upload from the heavy processing logic.
Hint 2
Think about how to provide an immediate user experience (e.g., returning a task ID and polling/webhooks) vs. a synchronous response.
Hint 3
Address how to cache results for common translations or identical images to save on expensive API costs or compute power.
Follow-up questions
- How would you handle images with multiple languages present, or text that is handwritten rather than printed?
- If the translation service has a strict rate limit, how would you design your system to prioritize requests and manage backpressure?
- How would you monitor the system to detect if the OCR model's accuracy starts degrading over time?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.