https://github.com/kritagya-web/nlp-speech_recognition_and_translation
A modern web application for translating and converting speech to text in various languages. Built with Next.js and Chakra UI for a responsive frontend, and FastAPI for the backend, which handles translation and text-to-speech services. Integrated using Docker for seamless deployment.
https://github.com/kritagya-web/nlp-speech_recognition_and_translation
Last synced: 7 months ago
JSON representation
A modern web application for translating and converting speech to text in various languages. Built with Next.js and Chakra UI for a responsive frontend, and FastAPI for the backend, which handles translation and text-to-speech services. Integrated using Docker for seamless deployment.
- Host: GitHub
- URL: https://github.com/kritagya-web/nlp-speech_recognition_and_translation
- Owner: Kritagya-web
- License: mit
- Created: 2025-02-10T22:40:20.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-02-10T22:41:28.000Z (8 months ago)
- Last Synced: 2025-02-10T23:27:34.661Z (8 months ago)
- Language: JavaScript
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NLP Speech Recognition and Translation Project [](https://opensource.org/licenses/MIT)
**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.

## Table of Contents
- [Features](#features)
- [Technologies Used](#technologies-used)
- [Project Structure](#project-structure)
- [Installation](#installation)
- [Usage](#usage)
- [Configuration](#configuration)
- [Contributing](#contributing)
- [License](#license)
- [Contact](#contact)## Features
- **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.## Technologies Used
### Frontend
- **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.### Backend
- **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.### Containerization
- **Docker**: Containerization platform to package applications and their dependencies.
## Project Structure
```plaintext
.
βββ backend
β βββ Dockerfile
β βββ app.py
β βββ requirements.txt
βββ frontend
β βββ Dockerfile
β βββ package.json
β βββ public
β βββ app
β β βββ api
β β βββ pages
| βββ components
βββ docker-compose.yml
```## Installation
### Prerequisites
- **Docker**: Make sure Docker is installed and running on your machine.
- **Node.js**: Node 18+ is required if running the frontend manually.### Running with Docker
1. Clone the repository:
```sh
git clone https://github.com/Kritagya-web/NLP-Speech-Translator-Website.git
cd NLP-Speech-Translator-Website
```2. Build and start the containers:
```sh
docker-compose up --build -d
```3. Access the application:
- Frontend: `http://localhost:3000`
- Backend: `http://localhost:8000`### Running Manually (skip if using Docker)
#### Backend
1. Navigate to the backend directory:
```sh
cd backend
```2. Install dependencies:
```sh
pip install -r requirements.txt
```3. Start the backend server:
```sh
uvicorn app:app --host 0.0.0.0 --port 8000
```#### Frontend
1. Navigate to the frontend directory:
```sh
cd frontend
```2. Add a `.env.local` file in the root (frontend).
3. In the `.env.local` file, add the following environment variable for the frontend to access the backend API:
```sh
# Or you may add the IP at which the Python backend is running here
NEXT_PUBLIC_TRANSLATOR_API_URL=http://localhost:8000
```4. Install dependencies:
```sh
npm install
```5. Start the frontend server:
```sh
npm run dev
```6. Access the frontend:
- Frontend: `http://localhost:3000`
## Usage
- **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.## Configuration
### Environment Variables
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`.
```yaml
environment:
- NEXT_PUBLIC_TRANSLATOR_API_URL=http://172.17.0.1:8000
```You can modify these values based on your setup.
### CORS Configuration
The `app.py` file in the backend specifies allowed origins for CORS. By default, it includes:
```python
origins = [
"http://localhost:3000",
"http://172.17.0.1:3000",
]
```Add or modify origins as needed.
## Contributing
Contributions are welcome! Please follow these steps:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Commit your changes (`git commit -m 'Add some feature'`).
4. Push to the branch (`git push origin feature-branch`).
5. Open a pull request.## License [](https://opensource.org/licenses/MIT)
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Contact
Developed by [Kritagya Kumra](https://github.com/Kritagya-web). For any inquiries, please contact me via [kritagyakumra@gmail.com](mailto:kritagyakumra@gmail.com).
**LinkedIn:** [Kritagya Kumra](https://www.linkedin.com/in/kritagya-kumra-bba9b41b6/)
**LeetCode:** [Kritagya Kumra](https://leetcode.com/u/Kritagya7777/)
---
Thank you for using the NLP Speech Recognition and Translation Project! We hope you find it helpful and easy to use.