AI Translator is a web-based translation tool that leverages cutting-edge AI models to provide real-time language translation. The application features a modern, responsive front-end built using Web Components, while the backend is powered by Flask and FastAPI frameworks. The AI capabilities are enabled through Hugging Face's Transformers API and an SLM (Small Language Model) model.
- Web Components: The UI of the AI Translator is designed using Web Components, allowing for encapsulated, reusable custom elements. This approach ensures a modern, modular frontend architecture.
- Flask: A lightweight WSGI web application framework that handles routing and basic server-side functionality for the AI Translator.
- FastAPI: This framework powers the API endpoints, enabling high-performance asynchronous handling of translation requests.
- Hugging Face: The application integrates Hugging Face's Transformers API, which provides access to state-of-the-art pre-trained models for natural language processing tasks, including translation.
- Python 3.x
-
Clone the repository.
git clone https://github.com/yourusername/ai-translator.git cd ai-translator
-
Install backend dependencies.
cd server pip install -r requirements.txt
-
Start the Flask and FastAPI servers. NOTE: Start either flask or FastAPI server
python translator.py # Flask server uvicorn main:translator --reload # FastAPI server
-
Serve the frontend using a local server.
cd client python -m http.server 3000
-
Open the application in your web browser.
http://localhost:3000
- Enter text in the input box and select the target language from the dropdown.
- Click the "Translate" button to get the translation.
- The translated text will appear below the input box.