Skip to content

karansrabcd01/voice-translator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ Real-Time Voice Translator

A professional multilingual real-time voice translation application with separate backend and frontend architecture.

๐Ÿ—๏ธ Project Structure

Real_time_Voice_translater/
โ”‚
โ”œโ”€โ”€ backend/                    # FastAPI Backend
โ”‚   โ”œโ”€โ”€ app.py                  # Main API application
โ”‚   โ”œโ”€โ”€ translation_graph.py    # Translation engine
โ”‚   โ”œโ”€โ”€ audio_handler.py        # Audio processing
โ”‚   โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”‚   โ”œโ”€โ”€ runtime.txt            # Python 3.11.0
โ”‚   โ”œโ”€โ”€ render.yaml            # Render deployment config
โ”‚   โ”œโ”€โ”€ .env                   # Environment variables
โ”‚   โ””โ”€โ”€ README.md              # Backend documentation
โ”‚
โ”œโ”€โ”€ frontend/                   # Web Frontend
โ”‚   โ”œโ”€โ”€ index.html             # User interface
โ”‚   โ”œโ”€โ”€ app.js                 # Client-side logic
โ”‚   โ”œโ”€โ”€ styles.css             # Styling
โ”‚   โ””โ”€โ”€ README.md              # Frontend documentation
โ”‚
โ”œโ”€โ”€ docs/                       # Documentation
โ”‚   โ”œโ”€โ”€ RENDER_DEPLOYMENT_STEPS.md
โ”‚   โ”œโ”€โ”€ QUICK_DEPLOY.md
โ”‚   โ”œโ”€โ”€ PROJECT_STRUCTURE.md
โ”‚   โ””โ”€โ”€ CLEAN_STRUCTURE.md
โ”‚
โ”œโ”€โ”€ .env                        # Root environment variables
โ”œโ”€โ”€ .gitignore                  # Git ignore rules
โ”œโ”€โ”€ serve_frontend.py           # Development server
โ””โ”€โ”€ README.md                   # This file

โœจ Features

  • ๐ŸŽค Real-time Voice Translation - Speak and hear translations instantly
  • ๐Ÿ’ฌ Text Translation - Type and translate between languages
  • ๐ŸŒ Multi-Language Support - English, Hindi, Telugu, Tamil, Kannada
  • ๐Ÿ”„ WebSocket Communication - Real-time bidirectional translation
  • ๐ŸŽจ Modern UI - Beautiful, responsive interface
  • ๐Ÿ”’ Secure - Environment-based API key management
  • ๐Ÿš€ Free Deployment - Deploy on Render and Vercel for free

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.11+
  • pip
  • Git
  • Web browser (Chrome/Edge recommended)

Local Development

1. Clone the Repository

git clone https://github.com/YOUR-USERNAME/voice-translator.git
cd voice-translator

2. Set Up Backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
.\venv\Scripts\Activate
# Mac/Linux:
source venv/bin/activate

# Install dependencies
cd backend
pip install -r requirements.txt

# Create .env file
echo "GROQ_API_KEY=your_api_key_here" > .env

# Run backend
uvicorn app:app --host 0.0.0.0 --port 8000 --reload

Backend will be available at: http://localhost:8000

3. Set Up Frontend

Open a new terminal:

# From project root
python serve_frontend.py

Frontend will be available at: http://localhost:3000

Testing

  1. Open http://localhost:3000 in two browser windows
  2. Enter the same room code (e.g., room123)
  3. Select different languages in each window
  4. Start chatting!

๐Ÿ“š Documentation

๐ŸŒ Deployment

Backend Deployment (Render)

  1. Push code to GitHub
  2. Create account on Render
  3. Create new Web Service
  4. Connect GitHub repository
  5. Set root directory: backend
  6. Add environment variable: GROQ_API_KEY
  7. Deploy!

Detailed guide: RENDER_DEPLOYMENT_STEPS.md

Frontend Deployment (Vercel)

  1. Create account on Vercel
  2. Import GitHub repository
  3. Set root directory: frontend
  4. Update API URL in frontend/app.js
  5. Deploy!

Detailed guide: Frontend README

๐Ÿ› ๏ธ Tech Stack

Backend

  • FastAPI - Modern Python web framework
  • LangChain - LLM orchestration
  • Groq API - Fast AI inference
  • WebSockets - Real-time communication
  • Uvicorn - ASGI server

Frontend

  • HTML5/CSS3/JavaScript - Modern web technologies
  • WebSocket API - Real-time updates
  • Web Speech API - Voice recognition and synthesis
  • Glassmorphism UI - Modern design

๐Ÿ“Š API Endpoints

REST API

  • GET / - Health check
  • POST /translate - Translate text
  • POST /audio/translate - Translate audio

WebSocket

  • WS /ws/{room_id} - Real-time translation

Full API documentation: http://localhost:8000/docs

๐Ÿ”‘ Environment Variables

Create .env file in backend/:

GROQ_API_KEY=your_groq_api_key_here
PORT=8000

Get your Groq API key from: https://console.groq.com

๐ŸŽฏ Use Cases

  • Language Learning - Practice conversations in different languages
  • International Teams - Communicate across language barriers
  • Customer Support - Assist customers in their native language
  • Travel - Communicate while traveling abroad
  • Education - Teach and learn multiple languages

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

This project is open source and available under the MIT License.

๐Ÿ™ Acknowledgments

  • Groq - For fast AI inference
  • LangChain - For LLM orchestration
  • FastAPI - For the amazing web framework
  • Render - For free hosting
  • Vercel - For frontend hosting

๐Ÿ“ง Contact

Your Name - your.email@example.com

Project Link: https://github.com/YOUR-USERNAME/voice-translator

๐Ÿ› Known Issues

  • First request after inactivity may take 30-60 seconds (Render free tier)
  • Speech recognition requires HTTPS in production
  • Some browsers may not support all features

๐Ÿ”ฎ Roadmap

  • Add more languages (Spanish, French, German, etc.)
  • Implement conversation history
  • Add user authentication
  • Support for group conversations (3+ people)
  • Mobile app version (React Native)
  • Offline mode with local models
  • Voice cloning for personalized TTS
  • Real-time video translation

๐Ÿ“ˆ Performance

  • Translation Speed: ~500ms average
  • WebSocket Latency: < 100ms
  • Concurrent Users: Unlimited
  • Uptime: 99.9% (on paid tier)

๐Ÿ” Security

  • API keys stored in environment variables
  • CORS configured for security
  • WebSocket connections validated
  • No sensitive data logged

๐Ÿ’ฐ Cost

Free Tier:

  • Render: 750 hours/month
  • Vercel: Unlimited
  • Groq API: Free tier available

Total Cost: $0/month for moderate usage

๐ŸŒŸ Star History

If you find this project useful, please consider giving it a star! โญ


Made with โค๏ธ by [Your Name]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published