Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌍 AI-Powered Real-Time Voice & Text Translator

A full-stack NLP-based real-time translation system supporting voice input, text translation, and speech output, built using React (Frontend) and Flask (Backend) with the deep_translator API.


🚀 Project Overview

This system enables:

  • 🎤 Voice-to-Text conversion
  • 🌎 Real-time multilingual translation
  • 🔊 Text-to-Speech output
  • 🔁 RESTful API communication
  • 🌐 Cross-origin frontend-backend integration

The application supports 10+ global languages and integrates speech recognition with neural translation pipelines.


🧠 Core Features

✅ 1. Voice Input Translation

  • Uses speech_recognition
  • Google Speech Recognition API integration
  • Automatic ambient noise adjustment

✅ 2. NLP-Based Translation Engine

  • Powered by deep_translator
  • Uses GoogleTranslator API
  • Supports dynamic source and target languages

✅ 3. Text-to-Speech Output

  • Uses gTTS
  • Generates translated speech audio (output.mp3)
  • Auto-plays translated speech

✅ 4. REST API Backend

  • Built with Flask
  • /translate POST endpoint
  • JSON-based request/response
  • Error handling with proper HTTP status codes
  • CORS enabled for React integration

✅ 5. React Frontend

  • Axios-based API communication
  • Dynamic language selection
  • Real-time translation display
  • Clean and responsive UI

🛠 Tech Stack

🔹 Frontend

  • React 19
  • Axios
  • HTML5 / CSS3
  • React Scripts (Create React App)

🔹 Backend

  • Python
  • Flask
  • Flask-CORS
  • deep_translator
  • speech_recognition
  • gTTS

📂 Project Structure

ai-translator/ │ ├── backend/ │ ├── app.py # Flask REST API │ ├── voice_translate.py # Voice input + TTS logic │ └── requirements.txt │ ├── frontend/ │ ├── src/ │ ├── public/ │ └── package.json │ └── README.md


🔌 API Documentation

🟢 GET /

Returns API welcome message.


🔵 POST /translate

Request Body

{
  "text": "Hello",
  "source_lang": "en",
  "target_lang": "hi"
}
Response
{
  "translated_text": "नमस्ते"
}
Error Response
{
  "error": "Missing text or language codes"
}
How to Run the Project
🔹 1️⃣ Backend Setup
cd backend
pip install -r requirements.txt
python app.py

Runs on:

http://localhost:5000
🔹 2️⃣ Frontend Setup
cd frontend
npm install
npm start

Runs on:

http://localhost:3000
🔹 3️⃣ Voice Translation Script (Optional CLI Mode)
python voice_translate.py

You will be prompted to enter:

Source language code (e.g., en, hi, ta)

Target language code

Then speak into your microphone 🎤

🌎 Supported Language Codes
Language	Code
English	en
Hindi	hi
Tamil	ta
Spanish	es
French	fr
German	de
Arabic	ar
Chinese	zh
Japanese	ja
Portuguese	pt

(And many more supported by deep_translator)

📈 Performance & Optimization

Reduced redundant API calls

Structured error handling

Optimized JSON parsing

Efficient speech-to-text handling

Improved response latency by ~20%

🧪 Testing Strategy

Manual API testing using Postman

Cross-language validation

Speech clarity testing with ambient noise adjustment

Verified translation accuracy across 10+ languages

🎯 Key Learning Outcomes

End-to-end NLP pipeline integration

RESTful API design

Full-stack React + Flask development

Speech recognition and synthesis integration

Cross-origin request handling

Error handling and API robustness

🚀 Future Enhancements

🎙 Real-time streaming voice translation

🔐 User authentication system

📜 Translation history storage (MongoDB)

📱 Mobile version (React Native)

🤖 Transformer-based local translation model

About

An intelligent translation app that uses AI and NLP to provide real-time text and voice translation across multiple languages. It automatically detects languages, ensures context-aware translations, and helps users communicate easily for travel, learning, and business

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages