Welcome to the NLP Speech Recognition and Translation Project! 🌍🔊
In today's globalized world, effective communication across different languages is more important than ever. Our project addresses this need by providing a seamless and intuitive solution for real-time speech translation and text-to-speech conversion. Whether you're traveling, working with international teams, or learning a new language, our application is designed to make language barriers a thing of the past.
Access the hosted project
Hosted Speech Translator Website
- Features
- Technologies Used
- Project Structure
- Installation
- Usage
- Configuration
- Contributing
- License
- Contact
- Speech to Text Translation 🎤➡️📝: Speak in your native language, and watch as your words are translated into text in another language in real-time.
- Text to Speech Conversion 📝➡️🔊: Convert written text into natural-sounding speech in both the source and target languages.
- Manual Text Input 🖊️: Double-click on the editor to manually enter text if you prefer typing over speaking.
- Copy Text Functionality 📋: Easily copy the translated text with a single click.
- User-Friendly Interface 🖥️: Our application features a clean and intuitive UI built with Chakra UI, ensuring a smooth user experience.
- Next.js: A React framework for server-side rendering and static site generation.
- React: A JavaScript library for building user interfaces.
- Chakra UI: A simple, modular, and accessible component library that gives you the building blocks to build React applications.
- FastAPI: A modern, fast (high-performance) web framework for building APIs with Python.
- Google Translator: Library for translating text.
- gTTS (Google Text-to-Speech): A Python library and CLI tool to interface with Google Translate’s text-to-speech API.
- Docker: Containerization platform to package applications and their dependencies.
.
├── backend
│ ├── Dockerfile
│ ├── app.py
│ ├── requirements.txt
├── frontend
│ ├── Dockerfile
│ ├── package.json
│ ├── public
│ ├── app
│ │ ├── api
│ │ ├── pages
| ├── components
├── docker-compose.yml
- Docker: Make sure Docker is installed and running on your machine.
- Node.js: Node 18+ is required if running the frontend manually.
-
Clone the repository:
git clone https://github.com/Aditya-Mishra799/NLP-Speech-Translator-Website.git cd NLP-Speech-Translator-Website -
Build and start the containers:
docker-compose up --build -d
-
Access the application:
- Frontend:
http://localhost:3000 - Backend:
http://localhost:8000
- Frontend:
-
Navigate to the backend directory:
cd backend -
Install dependencies:
pip install -r requirements.txt
-
Start the backend server:
uvicorn app:app --host 0.0.0.0 --port 8000
-
Navigate to the frontend directory:
cd frontend -
Add a
.env.localfile in the root (frontend). -
In the
.env.localfile, add the following environment variable for the frontend to access the backend API:# Or you may add the IP at which the Python backend is running here NEXT_PUBLIC_TRANSLATOR_API_URL=http://localhost:8000 -
Install dependencies:
npm install
-
Start the frontend server:
npm run dev
-
Access the frontend:
- Frontend:
http://localhost:3000
- Frontend:
- Speak to Translate: Click the microphone icon to start speaking. The spoken words will be translated into text in the target language.
- Text to Speech: Click the speaker icon to convert text to speech in the selected language.
- Manual Text Input: Double-click the editor to enter text manually.
- Copy Text: Use the copy button to copy translated text.
The docker-compose.yml file includes environment variables for the frontend service. These variables are set to interact with the backend service running at http://172.17.0.1:8000.
environment:
- NEXT_PUBLIC_TRANSLATOR_API_URL=http://172.17.0.1:8000You can modify these values based on your setup.
The app.py file in the backend specifies allowed origins for CORS. By default, it includes:
origins = [
"http://localhost:3000",
"http://172.17.0.1:3000",
]Add or modify origins as needed.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch). - Commit your changes (
git commit -m 'Add some feature'). - Push to the branch (
git push origin feature-branch). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Developed by Aditya Mishra. For any inquiries, please contact me via adityamishra9124@gmail.com.
LinkedIn: Aditya Mishra
LeetCode: Aditya Mishra
Thank you for using the NLP Speech Recognition and Translation Project! We hope you find it helpful and easy to use.
