Skip to content
tsar0705Public

About

ShramSetu - Beyond Translation, Towards Shared Understanding. A voice-first multilingual workplace communication assistant for Bharat, combining AI-powered translation, independent teach-back verification, discrepancy detection and bilingual clarification. Built with FastAPI, Gemini, Docker and a mobile-first PWA.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShramSetu (श्रमसेतु / ஷ்ரம்சேது)

Multilingual Workplace Teach-Back Verification: Implementation, Evaluation & Architecture Analysis

Permanent Safety Disclaimer:
ShramSetu is a communication-assistance prototype. Matching critical details does not certify comprehension, physical compliance or workplace safety. It does not replace approved safety procedures, training or human supervision.


Round 2 Demonstration Video & Live Prototype

Watch ShramSetu Round 2 Demo

What the Walkthrough Demonstrates:

  • Voice-First Multilingual Workflow: Tamil supervisor instruction -> live Hindi translation -> mandatory human review -> genuine spoken Hindi worker restatement (Machine 2 mismatch) -> live discrepancy detection with Tamil supervisor advisory & Hindi clarification question -> corrected spoken Hindi teach-back (Machine 3) -> Critical Details Match.
  • Live AI vs. Guided Demo Distinction: Genuine live Gemini translation and teach-back verification run when a valid GEMINI_API_KEY is configured (as demonstrated on Render and locally via docker compose up). When no key is present (or when selected via the header toggle), ShramSetu provides seven explicitly labelled predefined Guided Demo scenarios (Guided Demo — Predefined Examples, Not Live AI).

1. Executive Summary & Core Objective

In Indian industrial and manufacturing environments, instructions frequently originate from supervisors in one regional language (e.g. Tamil) and must be understood and carried out by factory floor workers in another (e.g. Hindi, Telugu, Bengali, English).

Conventional machine translation fails safety-critical operations because:

  1. Supervisors cannot independently verify whether colloquial target-language phrasing conveys the intended safety boundaries.
  2. Workers commonly give bare polite acknowledgements ("हाँ, समझ गया" / "Yes, understood") without comprehending critical operational constraints.
  3. Translation alone does not detect semantic reversals (e.g., “keep switched off until maintenance arrives” becoming “switch off and then restart”).

ShramSetu implements a multilingual teach-back verification protocol:

  • Supervisor Source Instruction: Accepted via editable text or voice dictation in any configured regional language.
  • Dynamic Workplace Translation: Translated to the worker's native tongue (or bypassed with 0ms latency in same-language mode).
  • Mandatory Human Review Gate: Supervisor explicitly confirms that the translation and extracted parameters preserve the safety intent before any worker verification.
  • Worker Independent Restatement: Captured in the worker's language and independently compared against the supervisor's instruction.
  • Direct Multilingual Semantic Verification (Approach B Engine): Validates critical operational parameters (Equipment, Action, Quantity, Restriction, Condition) without brittle language-specific keyword dependencies.
  • Targeted Multilingual Clarification: Automatically generates follow-up clarification questions rendered in the worker's language for immediate spoken resolution.

2. Multilingual Extensibility & Language-Pair Capability Matrix

ShramSetu features a centralized language registry (languages.py) with support for 10 Indian manufacturing languages.

Language-Pair Status & Directionality Policy

In safety-critical manufacturing operations, language capabilities are inherently directional. Testing comprehension for Tamil → English does not imply that the reverse direction (English → Tamil) has been verified.

Accordingly, ShramSetu maintains separate pair statuses:

  • Initial Pilot (ta → hi): The primary benchmarked and field-tested prototype pair.
  • Reported Tested: Pairs that have undergone automated live LLM verification test suites (en → hi, ta → en, te → hi, en → en).
  • Configured / Experimental: Configured in the registry with valid ISO-639-1 codes, native script names, and BCP-47 voice locales, but awaiting empirical domain testing. Reverse directions of tested pairs remain Configured/Experimental until specifically benchmarked.

Language-Pair Capability Matrix

Language Pair Pair Status Translation Status Verification Status Speech Recognition (STT) Audio Playback (TTS) Presets & UI
Tamil → Hindi (ta → hi) Initial Pilot Verified (Live Gemini) Verified (Live Gemini + Presets) Supported (ta-IN) Supported (hi-IN) Dedicated UI Presets
English → Hindi (en → hi) Reported Tested Verified (Live Gemini) Verified (Live Gemini Test Suite) Supported (en-IN) Supported (hi-IN) Configurable Dropdown
Tamil → English (ta → en) Reported Tested Verified (Live Gemini) Verified (Live Gemini Test Suite) Supported (ta-IN) Supported (en-IN) Configurable Dropdown
Telugu → Hindi (te → hi) Reported Tested Verified (Live Gemini) Verified (Live Gemini Test Suite) Browser-dependent (te-IN) Supported (hi-IN) Configurable Dropdown
English → English (en → en) Reported Tested (Same-Lang) Identity Bypass (0ms) Verified (Live Gemini Test Suite) Supported (en-IN) Supported (en-IN) Configurable Dropdown
Hindi → Tamil (hi → ta) Configured / Experimental Untested Untested Configured (hi-IN) Browser-dependent (ta-IN) Reverse swap available
All Other Pairs (kn, ml, bn, mr, gu, or) Configured / Experimental Untested Untested Configured BCP-47 locale Device voice dependent Configurable Dropdown

Centralized Language Configuration (Individual Languages)

Language ISO Code Native Display BCP-47 Voice Locale Verification Status Speech Capability Note
Tamil ta தமிழ் - Tamil ta-IN Verified (Pilot & Test Suite) Remote/local voice dependent
Hindi hi हिंदी - Hindi hi-IN Verified (Pilot & Test Suite) Widely available on standard OS
English en English - English en-IN Verified (Cross-Lingual & Same-Lang) Universally available on all devices
Telugu te తెలుగు - Telugu te-IN Verified (Cross-Lingual Test Suite) Remote/local voice dependent
Kannada kn ಕನ್ನಡ - Kannada kn-IN Configured / Experimental Remote/local voice dependent
Malayalam ml മലയാളം - Malayalam ml-IN Configured / Experimental Remote/local voice dependent
Bengali bn বাংলা - Bengali bn-IN Configured / Experimental Remote/local voice dependent
Marathi mr मराठी - Marathi mr-IN Configured / Experimental Remote/local voice dependent
Gujarati gu ગુજરાતી - Gujarati gu-IN Configured / Experimental Remote/local voice dependent
Odia or ଓଡ଼ିଆ - Odia or-IN Configured / Experimental Remote/local voice dependent

Important Disclosure on Language Status:

  • Dropdown options display purely ${native_name} - ${name} without confusing language-level status suffixes.
  • Directional status badges appear prominently outside the dropdowns (Initial Pilot, Reported Tested, or Configured / Experimental).
  • Wispr Flow and external dictation compatibility is achieved via standard, focusable, editable HTML <textarea> inputs. We do not claim verified proprietary acoustic models for all 10 languages within Wispr Flow itself.

3. Architecture, Safety Mechanisms & Multilingual Workflow

Active Provider, Independent Configuration & Local AI Realities

  • Default Production Providers: TRANSLATION_PROVIDER=gemini and VERIFICATION_PROVIDER=gemini (gemini-3.5-flash-lite / gemini-flash-lite-latest), configured via GEMINI_API_KEY.
  • Independent Provider Architecture: Translation and verification providers are independently configurable, preserving clean extension points for future validated local providers (e.g., indictrans2 for translation or a separately evaluated local LLM for verification). Unimplemented providers fail explicitly rather than falling back silently.
  • Local Model Safeguards:
    • qwen2.5:1.5b is marked experimental and unsuitable for normal verification and is blocked from normal /api/verify requests (HTTP 503).
    • When Gemini fails (HTTP 429, timeout, network error, or missing credentials), ShramSetu never automatically switches to qwen2.5:1.5b and never silently substitutes simulated preset outputs.
    • Failed verification immediately clears any stale success state and displays an explicit Verification Unavailable banner in the primary interface.
  • Honest Experimental Findings (API-Key-Free Feasibility):
    • Local inference was demonstrated using Ollama (qwen2.5:1.5b).
    • The tested 1.5B model failed quality requirements: Tamil-to-Hindi translation quality was unacceptable, verification accuracy was 4/8, false confirmations were 4/4, and false rejections were 0/4.
    • The 7B model was not downloaded or evaluated successfully.
    • Model size alone does not guarantee reliability.
    • Full GPU offloading does not mean zero system RAM usage.
    • Chrome Translator timed out in the embedded browser.
    • IndicTrans2 was investigated but not executed.
    • API-key-free operation at acceptable quality remains a future objective.

Safety-First Language Swapping

  • Clicking the Language Swap (⇄) button inverts the supervisor and worker languages and swaps active dropdowns.
  • Safety Hazard Mitigation: Unlike naive implementations that copy worker text into the supervisor input, ShramSetu explicitly clears the worker restatement field upon swapping. This prevents erroneous or incomplete worker restatements from being inadvertently promoted into confirmed supervisor safety directives.
  • All downstream states (translation, supervisor confirmation, verification result) are reactively invalidated.

Same-Language Teach-Back Mode (Zero-Latency Translation)

  • When supervisor and worker share the same language (e.g., en → en or hi → hi):
    • Translation is recognized as an identity operation.
    • The application automatically bypasses the translation LLM call, achieving 0ms translation latency.
    • The verification engine continues to rigorously audit the restatement against the original for missing constraints, machine mismatches, and polarity reversals.

Bilingual Clarification Channels

When a discrepancy is detected between the supervisor's instruction and the worker's restatement:

  1. Worker Clarification Question (#workerQuestionBox): Rendered in the worker's target language (e.g., Hindi) with a direct, spoken question clarifying the exact point of confusion.
  2. Supervisor Advisory (#supervisorGuidanceBox): Rendered in the supervisor's source language (e.g., Tamil) explaining exactly how the worker's restatement contradicted the instruction (e.g. சூப்பர்வைசர் 'மெஷின் நம்பர் 3' என்று சொன்னதை, தொழிலாளி 'மெஷின் நம்பர் 2' என்று மாற்றிச் சொல்லியுள்ளார்.).

Device Speech & Audio Capability Detection

  • The UI inspects window.SpeechRecognition || window.webkitSpeechRecognition to verify dictation support.
  • The UI hooks speechSynthesis.onvoiceschanged asynchronously to inspect available system and remote voices, accurately indicating whether matching voices exist for the selected source and target BCP-47 locales.

4. Comprehensive Empirical Evaluation Across All Phases

Evaluation Sets Overview

  1. Development Set (8 Cases): Hand-crafted lockout-tagout scenarios used during initial prototype authoring.
  2. Regression Set (12 Cases): Additional structured test cases covering unit conversions, numbers, and boundary conditions.
  3. Phase 3 Held-Out Debugging Set (10 Cases): 10 fresh tasks (positive paraphrases, numeric representations, negative imperatives).
  4. Phase 4 Fresh Independent Dataset (12 Cases): Pre-annotated industrial scenarios testing PPE requirements, warehouse transfers, emergency valves, sequential processes, bare acknowledgements, critical omissions, quantity contradictions, equipment contradictions, polarity reversals, unauthorized hazardous actions, and ambiguous utterances.
  5. Multilingual Capability Suite (7 Cases): New automated test suite validating registry completeness, same-language identity bypass, unconfirmed supervisor rejection, and cross-lingual matches and mismatches across English, Hindi, and Tamil.

Summary Results Across Test Sets

Evaluation Suite Approach A (Fixed Schema) Approach B (Single-LLM Baseline) Approach C (Adaptive Schema)
All Automated Unit & Integration Tests (Pytest) 42 / 42 (100%) N/A N/A
Original Development Suite (8 cases) 8 / 8 (100%) 8 / 8 (100%) 8 / 8 (100%)
Regression Suite (12 cases) 12 / 12 (100%) 12 / 12 (100%) 12 / 12 (100%)
Phase 3 Debugging Set (10 cases) 6 / 10 (60.0%) 10 / 10 (100%) 9 / 10 (90.0%)
Phase 4 Fresh Held-Out Suite (12 cases) 7 / 12 (58.3%) 12 / 12 (100.0%) 7 / 12 (58.3%)
Multilingual Capabilities Suite (7 cases) N/A 7 / 7 (100.0%) N/A

5. Phase 4 Independent Evaluation Detailed Metrics

Tested on live Google Gemini models (gemini-3.5-flash-lite / gemini-flash-lite-latest) with independent worker extraction (worker extraction never receives supervisor targets).

Metric Approach A (Fixed 5-Field) Approach B (Single-LLM Baseline) Approach C (Adaptive Schema)
Overall Accuracy 7 / 12 (58.3%) 12 / 12 (100.0%) 7 / 12 (58.3%)
Balanced Accuracy 50.0% 100.0% 52.9%
Positive Paraphrase Accuracy 0 / 5 (0.0%) 5 / 5 (100.0%) 1 / 5 (20.0%)
False Rejection Rate (FRR) 100.0% (5/5) 0.0% (0/5) 80.0% (4/5)
False Confirmation Rate (FCR) 0.0% (0/7) 0.0% (0/7) 14.3% (1/7)
Average Decision Latency 35.67s 6.12s 35.53s
Safety Violation Capture High Perfect (7/7) Moderate (6/7)

6. System Setup & Running the Tests

One-Command Docker Startup (No API Keys Required)

Judges can run ShramSetu with zero .env file, zero local Python setup, and zero external API keys:

git clone https://github.com/tsar0705/ShramSetu.git
cd ShramSetu
docker compose up

(Or docker compose up --build to rebuild from source.)

  • Application URL: http://localhost:8000
  • Health Check: http://localhost:8000/health
  • No-Key Guided Demo: Click 🎭 Guided Demo (No-Key Mode) in the top-right header to explore all 7 predefined scenarios (Guided Demo — Predefined Examples, Not Live AI) without any cloud credentials.

Local Python Setup (Alternative)

  • Python 3.10+
  • Optional .env with GEMINI_API_KEY for live cloud translation & verification (GEMINI_MODEL=gemini-3.5-flash-lite)
pip install -r requirements.txt
uvicorn app:app --host 127.0.0.1 --port 8000

Open your browser to http://127.0.0.1:8000.

Mobile & PWA Installation

  • Android (Chrome): Tap the menu (⋮) → Install app or Add to Home screen (or use the 📲 Install App button when prompted).
  • iOS (Safari): Tap Share → Add to Home Screen.
  • Offline Caching Policy: The service worker (static/sw.js) caches static UI assets only. Live /api/* translation and verification responses are never cached, and Gemini-powered live AI requires internet connectivity. PWA installation requires HTTPS in public deployments (localhost is exempt during local development).

Running All Automated Tests (47 Tests Passing)

python -m pytest test_audit_defects.py test_verification.py test_app.py test_multilingual_capabilities.py test_provider_safeguards.py test_round2_readiness.py -v

7. Dependencies, Risks, Limitations & Team Credits

  • Third-Party Dependencies: FastAPI, Uvicorn, Pydantic, Pytest, Python-dotenv; optional Google Gemini REST API; browser-native Web Speech API (SpeechRecognition, speechSynthesis) and Wispr Flow external dictation via standard editable <textarea> fields.
  • Provider Cost & Availability Risks: Live cloud inference depends on Gemini API quota and network reachability; HTTP 429/503/timeouts fail explicitly with a Verification Unavailable banner and never fall back silently to simulated outputs or the unsuitable local 1.5B model.
  • Current Limitations: Physical-device speech testing is hardware-dependent; browser emulation does not substitute for live factory-floor microphone testing. Local 1.5B inference is restricted as experimental/unsuitable for production safety verification.
  • Team Credits: Built by Team DreamXChasers for the Scaler × Wispr Flow Hackathon (Theme: Everyday Access).

8. Directory Structure

ShramSetu/
├── Dockerfile                         # Python 3.11-slim container with /health check
├── docker-compose.yml                 # Root-level Compose config (port 8000, no .env required)
├── .dockerignore                      # Excludes .env, caches, archives, and scratch files
├── app.py                             # FastAPI web application, /health, & REST endpoints
├── guided_demo.py                     # 7 explicit no-key Guided Demo scenarios
├── languages.py                       # Centralized language configuration & registry (10 languages)
├── schemas.py                         # Pydantic models for Approach A, B, C & multilingual requests
├── verification.py                    # Deterministic comparator & adaptive matching logic
├── prompts.py                         # Dynamic multilingual prompts for translation & verification
├── llm_service.py                     # Independent provider router (Gemini default, local safeguards)
├── test_round2_readiness.py           # Automated Round 2 no-key, Guided Demo, PWA, and Docker checks
├── test_provider_safeguards.py        # Automated tests for Gemini no-fallback & 1.5B restriction
├── test_multilingual_capabilities.py  # Automated tests for multilingual & same-language verification
├── test_audit_defects.py              # Automated tests for independent comparator defect audits
├── test_verification.py               # Pytest unit tests for verification engine
├── test_app.py                        # Pytest integration tests for FastAPI endpoints
├── static/
│   ├── index.html                     # Multilingual & PWA-enabled web frontend
│   ├── style.css                      # Responsive stylesheet with mobile & Guided Demo styles
│   ├── app.js                         # Dynamic state machine, Guided Demo, PWA & STT/TTS
│   ├── manifest.json                  # Standalone PWA manifest
│   ├── sw.js                          # Static-only service worker (excludes /api/*)
│   └── icons/                         # 192x192 and 512x512 PNG application icons
├── requirements.txt                   # Python dependencies
├── .env.example                       # Environment variable template (safe placeholders only)
└── README.md                          # Comprehensive documentation & evaluation report

About

ShramSetu - Beyond Translation, Towards Shared Understanding. A voice-first multilingual workplace communication assistant for Bharat, combining AI-powered translation, independent teach-back verification, discrepancy detection and bilingual clarification. Built with FastAPI, Gemini, Docker and a mobile-first PWA.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages