Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

22 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ LinguaFlow

AI-Powered Multilingual Translation Platform

Live Demo GitHub

LinguaFlow is a resilient multilingual AI translation platform built with Python, Streamlit, Google Gemini, NVIDIA Nemotron, SQLite, and automatic language detection.

The core engineering idea is a multi-provider fallback architecture: Gemini 2.5 Flash handles primary translation, Gemini Flash-Lite provides a secondary fallback, and NVIDIA Nemotron 3 Ultra acts as the final reliability provider.

๐Ÿš€ Live Demo

Try LinguaFlow: https://linguaflowtranslate.streamlit.app/

Source Code: https://github.com/nabinchettri18/CodeAlpha_LinguaFlow

The hosted Streamlit deployment uses the Google GenAI Python SDK directly. Local development can use the Node.js Gemini service.


โœจ Key Features

  • ๐ŸŒ Multilingual AI translation
  • ๐Ÿ” Automatic language detection
  • โšก SQLite translation caching
  • ๐Ÿค– Gemini 2.5 Flash primary provider
  • ๐Ÿ”„ Gemini Flash-Lite secondary fallback
  • ๐Ÿ›ก๏ธ NVIDIA Nemotron 3 Ultra final fallback
  • โ™ป๏ธ Retry, cooldown, and graceful provider failure handling
  • โœ… Translation output validation
  • ๐Ÿงฉ Streamlit web interface
  • โ˜๏ธ Streamlit Cloud deployment
  • ๐Ÿ’ป Local Node.js Gemini service for development
  • ๐Ÿ” Environment / Streamlit Secrets based configuration

๐Ÿง  Translation Pipeline

                         LINGUAFLOW
                             โ”‚
                             โ–ผ
                       SQLite Cache
                       โ”‚          โ”‚
                     HIT         MISS
                       โ”‚          โ”‚
                       โ–ผ          โ–ผ
                    Result   Gemini 2.5 Flash
                                  โ”‚
                           failure / quota
                                  โ–ผ
                         Gemini Flash-Lite
                                  โ”‚
                           failure / quota
                                  โ–ผ
                      NVIDIA Nemotron 3 Ultra
                                  โ”‚
                               failure
                                  โ–ผ
                         TranslationError

A cache hit avoids an unnecessary AI request. On a cache miss, providers are attempted in order until a valid translation is returned or all available providers fail.


๐Ÿ—๏ธ Deployment Architecture

LinguaFlow supports two execution modes while keeping the same provider strategy.

Local Development

Streamlit
    โ†“
Translator
    โ†“
gemini_server.mjs
    โ†“
Node.js :8765
    โ†“
Google Gemini

Local mode:

GEMINI_USE_LOCAL_SERVER=true

Streamlit Cloud

The hosted application does not require Node.js or gemini_server.mjs.

Streamlit Cloud
      โ†“
Python Translator
      โ†“
Google GenAI SDK
      โ†“
Google Gemini

Cloud mode:

GEMINI_USE_LOCAL_SERVER = false

This hybrid design keeps local development convenient while allowing the deployed application to run without a separate Node.js backend.


๐Ÿงฐ Tech Stack

Layer Technology
Frontend Streamlit
Application Python
Local AI service Node.js
Google AI SDK google-genai
Primary model Gemini 2.5 Flash
Secondary model Gemini Flash-Lite
Final fallback NVIDIA Nemotron 3 Ultra
Cache SQLite
Language detection langdetect
HTTP communication Requests
Configuration .env / Streamlit Secrets
Deployment Streamlit Cloud

๐Ÿ“ Project Structure

CodeAlpha_LinguaFlow/
โ”‚
โ”œโ”€โ”€ app.py
โ”œโ”€โ”€ gemini_server.mjs
โ”œโ”€โ”€ load_test.py
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ package-lock.json
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ .gitignore
โ”‚
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ languages.py
    โ”œโ”€โ”€ language_detector.py
    โ”œโ”€โ”€ main.py
    โ””โ”€โ”€ translator.py

.env, API credentials, and private runtime data should not be committed.


โš™๏ธ Local Installation

1. Clone

git clone https://github.com/nabinchettri18/CodeAlpha_LinguaFlow.git
cd CodeAlpha_LinguaFlow

2. Create a virtual environment

python -m venv .venv

Windows PowerShell:

.\.venv\Scripts\Activate.ps1

3. Install Python dependencies

pip install -r requirements.txt

4. Install Node dependencies

npm install

Node.js is required only for local Gemini-service mode.

5. Configure .env

Example:

GEMINI_USE_LOCAL_SERVER=true

GOOGLE_API_KEY=your_google_api_key
GEMINI_API_KEY=your_google_api_key

GEMINI_URL=http://127.0.0.1:8765/translate
GEMINI_HEALTH_URL=http://127.0.0.1:8765/health

GEMINI_PRIMARY_MODEL=gemini-2.5-flash
GEMINI_FALLBACK_MODEL=gemini-3.1-flash-lite

NVIDIA_API_KEY=your_nvidia_api_key
NVIDIA_CHAT_URL=https://integrate.api.nvidia.com/v1/chat/completions
NEMOTRON_MODEL=nvidia/nemotron-3-ultra-550b-a55b

6. Run

python -m streamlit run app.py

โ˜๏ธ Streamlit Cloud

Configure these values under Manage app โ†’ Settings โ†’ Secrets:

GOOGLE_API_KEY = "your_google_api_key"
GEMINI_USE_LOCAL_SERVER = false
NVIDIA_API_KEY = "your_nvidia_api_key"

The Cloud deployment then uses:

Streamlit Cloud
      โ†“
Python Translator
      โ†“
Google GenAI SDK
      โ†“
Gemini

No local port 8765 or Node.js process is required.


๐Ÿ”„ Provider Strategy

Priority Provider Role
1 Gemini 2.5 Flash Primary translation
2 Gemini Flash-Lite Secondary fallback
3 NVIDIA Nemotron 3 Ultra Final reliability fallback

Normal request

Request
   โ†“
SQLite Cache
   โ†“ MISS
Gemini 2.5 Flash
   โ†“
Success โ†’ Cache โ†’ Return

Primary failure

Gemini 2.5 Flash
       โ†“ FAILURE
Gemini Flash-Lite
       โ†“ SUCCESS
Cache โ†’ Return

Complete Gemini failure

Gemini 2.5 Flash
       โ†“ FAIL
Gemini Flash-Lite
       โ†“ FAIL
NVIDIA Nemotron 3 Ultra
       โ†“ SUCCESS
Return Translation

๐Ÿ—„๏ธ SQLite Cache

LinguaFlow checks the SQLite cache before making an AI request.

Translation Request
       โ†“
Cache Lookup
   โ†™         โ†˜
 HIT         MISS
  โ†“            โ†“
Result       AI Provider
               โ†“
           Translation
               โ†“
           Save Cache

Caching reduces repeated API calls and improves response time for repeated translations.


๐Ÿ” Automatic Language Detection

Users can select Auto-detect as the source language. LinguaFlow uses its language detection module to determine the source language before translation.


๐Ÿ›ก๏ธ Reliability

Provider responses are validated before being accepted as successful translations.

Provider Request
      โ†“
Response Received
      โ†“
Validate Output
   โ†™          โ†˜
VALID        INVALID
 โ†“             โ†“
Return       Next Provider

The application also uses retry/cooldown behavior for transient failures and moves to the next provider when a provider becomes unavailable or rate-limited.


๐Ÿงช Nemotron Load Test

Nemotron was independently tested with 25 unique concurrent translation requests while Gemini providers were intentionally skipped.

Metric Result
Total requests 25
Successful 25
Failed 0
Success rate 100%
Average latency 160.69 s
Fastest 128.40 s
Slowest 489.55 s
P50 latency 131.02 s
P95 latency 419.86 s
P99 latency 489.47 s
Throughput 0.05 req/s
Overall status PASS

Nemotron's measured latency is substantially higher than the normal Gemini path, supporting its role as the final fallback rather than the primary provider.


๐ŸŽ“ CodeAlpha Internship Project

LinguaFlow is the completed project maintained for the CodeAlpha internship/project workflow.

Project highlights

  • Built a multilingual AI translation application
  • Designed a resilient multi-provider architecture
  • Integrated Google Gemini models
  • Integrated NVIDIA Nemotron as a final fallback
  • Implemented SQLite caching
  • Added automatic language detection
  • Implemented retry, cooldown, and output validation
  • Created a local Node.js Gemini service
  • Added a separate Streamlit Cloud execution path using the Google GenAI Python SDK
  • Deployed the application on Streamlit Cloud
  • Maintained the project with Git and GitHub

Submission links


๐Ÿ’ผ Portfolio

Description

LinguaFlow is an AI-powered multilingual translation platform built with Python and Streamlit. It uses SQLite caching and a resilient multi-provider architecture with Gemini 2.5 Flash as the primary translator, Gemini Flash-Lite as a secondary fallback, and NVIDIA Nemotron 3 Ultra as the final reliability provider. The application supports automatic language detection and separate local and Streamlit Cloud execution paths.

  • Built and deployed LinguaFlow, a multilingual AI translation platform using Python, Streamlit, Google Gemini, NVIDIA Nemotron, SQLite, and language detection.
  • Designed a multi-provider fallback architecture that automatically switches from Gemini 2.5 Flash to Gemini Flash-Lite and Nemotron when providers fail or become unavailable.
  • Implemented SQLite caching, retry handling, output validation, and provider cooldown logic to improve reliability and reduce repeated API requests.
  • Deployed the application to Streamlit Cloud using the Google GenAI Python SDK while retaining a Node.js Gemini service for local development.

Portfolio links


๐Ÿ“Œ Current Limitations

  • Nemotron is significantly slower than the normal Gemini path.
  • Translation quality can vary by language and provider.
  • External API availability, quotas, and rate limits can affect provider availability.
  • The project is currently an internship/portfolio-scale application rather than a large public production service.
  • User authentication and account management are not currently included.
  • Advanced analytics and distributed infrastructure are not currently implemented.

๐Ÿ”ฎ Future Development

  • Provider performance dashboard
  • Detailed cache analytics
  • Translation history
  • User accounts and authentication
  • Batch translation
  • PDF/DOCX translation
  • Voice translation
  • Public API
  • Mobile application
  • Browser extension
  • Distributed caching
  • Horizontal scaling
  • Automated multilingual quality evaluation

๐Ÿ”’ Security

Never publish:

  • API keys
  • .env files containing secrets
  • Private credentials
  • Service tokens

Use placeholders in documentation:

GOOGLE_API_KEY=your_google_api_key
NVIDIA_API_KEY=your_nvidia_api_key

For Streamlit Cloud, store credentials in Secrets, not in the repository.


๐Ÿ“Š Project Status

Multilingual Translation            โœ…
SQLite Cache                        โœ…
Automatic Language Detection       โœ…
Gemini Primary                      โœ…
Gemini Flash-Lite Fallback          โœ…
Nemotron Final Fallback             โœ…
Provider Failure Handling           โœ…
Local Development Mode              โœ…
Streamlit Cloud Deployment          โœ…
GitHub Repository                   โœ…
Live Demo                           โœ…
CodeAlpha Project                   โœ…

Overall Status: STABLE / DEPLOYED

LinguaFlow

AI-powered multilingual translation with resilient provider fallback.

Created by Nabin Chettri.

About

AI-powered multilingual translation platform built with Python and Streamlit, supporting seamless translation across multiple languages using modern AI technologies.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages