A context-aware translation tool that not only translates text but also provides cultural context, alternative translations, and pronunciation guides.
- Translate between multiple languages
- Provides cultural context for idioms and expressions
- Suggests alternative translations for different contexts
- Includes pronunciation guides for important words
- Simple and intuitive user interface
- Meet Lang the Penguin, your translation companion!
- Python 3.7 or higher
- A Groq API key (sign up at groq.com)
-
Clone the repository:
git clone https://github.com/yourusername/langwithlang-translator.git cd langwithlang-translator -
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install the required packages:
pip install -r requirements.txt
-
Create a
.envfile in the project root and add your Groq API key:GROQ_API_KEY=your-groq-api-key-here
-
Make sure your virtual environment is activated.
-
Run the Streamlit application:
streamlit run streamlit_translator.py
-
The application will open in your default web browser at
http://localhost:8501.
- Enter the text you want to translate in the input field.
- Select the source language (default is English).
- Select the target language you want to translate to.
- Click the "Translate" button.
- View the translation results, including cultural context, alternative translations, and pronunciation guides.
For the full experience, make sure the following image is in your project directory:
Penguin.png
You can customize the application by:
- Modifying the CSS in the
st.markdownsection - Adding more languages to the
languageslist in theContextAwareTranslatorclass - Changing the model by updating the
model_nameparameter in theContextAwareTranslatorclass