Skip to content

About

Accessible, Voice-First Retail POS & Intelligence System for Indian Retailers & Differently-Abled Merchants. Exclusively powered by Gnani.ai (Prisma STT & Timbre TTS) with Double-Entry Ledger Safety.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

BharatVoice AI

License: MIT Python: 3.11 FastAPI React: 18 Tests Voice: Gnani.ai Exclusive

Voice-First Retail Intelligence & Point-of-Sale System for Indian Store Owners.
Built for small retail businesses, supermarkets, and kirana stores with native multilingual Indic speech recognition, double-entry financial accounting, and safety-guarded voice commands.
All voice input and output is exclusively powered by Gnani.ai (Gnani Prisma STT & Gnani Timbre TTS).


๐Ÿ“Œ Table of Contents


๐Ÿ“– Overview

BharatVoice AI is an intelligent, voice-first retail management, Point-of-Sale (POS), and assistive technology platform designed to bridge the digital divide for retail shopkeepers across India. Powered exclusively by Gnani.ai's neural Indic voice stack alongside strict double-entry ledger mechanics, BharatVoice AI enables store ownersโ€”including differently-abled, visually impaired, and elderly merchantsโ€”to operate their business completely hands-free. By speaking naturally in their mother tongue (Telugu, Hindi, Indian English, Tamil, Kannada, or Malayalam), shopkeepers can check inventory, calculate gross and net profits, generate itemized tax receipts, and record expenses safely without keyboard or mouse dependency.


โš ๏ธ Problem Statement

Traditional enterprise retail software and modern POS tools present steep barriers for independent store owners in India:

  1. Severe Exclusion of Differently-Abled & Elderly Merchants: Conventional POS and billing software strictly mandate visual inspection, manual keyboard typing, and precise mouse/touchscreen interactions. Store owners with physical disabilities, visual impairments, tremors, arthritis, or limited motor dexterity are systematically excluded from managing their own billing and inventory, making them vulnerable to financial dependence or exploitation.
  2. Language Barriers: Most commercial retail software is strictly English-first, ignoring native regional languages spoken daily by shopkeepers in non-metro and rural belts.
  3. Counter Speed & Keyboard Friction: In crowded neighborhood kiranas and busy supermarkets, typing item names and finding buttons creates long queues and operational fatigue.
  4. Financial Vulnerability in Voice Systems: Generic voice-to-action tools lack safety checkpoints; an unintended utterance or misrecognized number could trigger destructive balance transfers, ledger corruptions, or incorrect cash drawer settlements.
  5. Cloud Brittleness: Many cloud-only platforms crash or freeze when suburban and rural connectivity drops, paralyzing checkout lines.

๐ŸŽฏ Project Objectives

  • Empower Differently-Abled & Motor-Impaired Store Owners: Transform retail billing into an accessible, hands-free experience so individuals with visual, physical, or motor disabilities can run their businesses with dignity and full operational autonomy.
  • Democratize Retail Technology Through Indic Voice: Provide an intuitive voice interface where shopkeepers speak comfortably in their native language (Telugu, Hindi, Tamil, Kannada, Malayalam, English).
  • Enforce Financial Integrity: Implement strict double-entry ledger mechanics where every transaction maintains debit/credit parity and generates tamper-evident audit trails.
  • Guarantee Action Safety: Introduce a Financial Safety Confirmation Gate that catches balance-altering operations and requires explicit voice or button verification before ledger commitment.
  • Exclusively Integrate Indic AI Voice: Standardize 100% of speech recognition and voice synthesis on Gnani.ai (Prisma STT & Timbre TTS), removing third-party or browser-fallback dependencies.

โœจ Key Features

  • โ™ฟ Inclusive Assistive Technology for Differently-Abled Retailers: Voice-in and voice-out bidirectional feedback allows visually impaired, motor-disabled, and elderly shopkeepers to manage store operations hands-free and eyes-free with 100% voice clarity.
  • ๐Ÿ—ฃ๏ธ Exclusive Gnani.ai Indic Voice Engine: 100% powered by Gnani Prisma STT for speech transcription and Gnani Timbre TTS for natural Indic speech synthesis across Telugu, Hindi, Indian English, Tamil, Kannada, and Malayalam.
  • ๐Ÿ›ก๏ธ Financial Safety Confirmation Gate: Any spoken or typed command altering finances (e.g., "Record electricity expense of 500 rupees") is caught by an amber confirmation gate, preventing unapproved ledger mutations.
  • ๐Ÿ“Š Real-Time Central Dashboard: Tracks Today's Sales, Completed Transactions, Products Listed, and Low-Stock Warnings alongside a 7-day sales velocity AreaChart.
  • ๐Ÿงพ Point-of-Sale (POS) & Tax Invoicing: Creates sequential bill records (BV-SALE-...), generates itemized tax receipts, and exports financial spreadsheets to CSV.
  • ๐Ÿ“ฆ Inventory & Real-Time Stock Search: Complete catalog management with real-time substring filtering, stock level indicators, and reorder alerts.
  • ๐Ÿช Dynamic Store Personalization: Configurable owner profiles, phone numbers, tax/GSTIN credentials, and store rebranding across all views.
  • ๐Ÿงช Comprehensive Test Coverage: 119 unit and integration tests covering API routes, duplicate detection, fault injection, and financial consistency.

๐ŸŽ™๏ธ Exclusive Gnani.ai Voice Engine

BharatVoice AI eliminates all generic or browser-based speech synthesis in favor of an exclusive integration with Gnani.ai's conversational AI platform:

+-----------------------------------------------------------------------------+
|                          Gnani.ai Voice Stack                               |
+-----------------------------------------------------------------------------+
| 1. Speech-to-Text (STT):                                                    |
|    - HTML5 MediaRecorder captures raw shopkeeper audio (16-bit 48 kHz WAV)  |
|    - Sent to backend `/api/voice/transcribe`                                |
|    - Processed by Gnani Prisma STT (vachana.ai API endpoint)                 |
|    - Handles mixed Indian vocabulary, retailer slang, and accent shifts     |
|                                                                             |
| 2. Text-to-Speech (TTS):                                                    |
|    - Intent response synthesized by Gnani Timbre TTS                        |
|    - Generated via backend `/api/voice/process` & `/api/voice/tts`           |
|    - High-fidelity 48 kHz linear PCM WAV encoded to base64 audio stream     |
|    - Decoded and played directly in browser via HTML5 Audio API             |
|                                                                             |
| 3. Supported Indic Languages:                                               |
|    - Telugu (te-IN - เฐคเฑ†เฐฒเฑเฐ—เฑ)                                                |
|    - Hindi (hi-IN - เคนเคฟเคจเฅเคฆเฅ€)                                                 |
|    - Indian English (en-IN)                                                 |
|    - Tamil (ta-IN - เฎคเฎฎเฎฟเฎดเฏ)                                                  |
|    - Kannada (kn-IN - เฒ•เฒจเณเฒจเฒก)                                                |
|    - Malayalam (ml-IN - เดฎเดฒเดฏเดพเดณเด‚)                                             |
+-----------------------------------------------------------------------------+

๐Ÿ’ป Technologies & Tools Used

Backend

  • Framework: FastAPI (Python 3.11+)
  • Server: Uvicorn (ASGI high-concurrency server)
  • ORM & Database: SQLAlchemy 2.0 with SQLite (WAL mode)
  • Validation: Pydantic v2
  • HTTP Client: HTTPX
  • Voice Services: Gnani.ai Prisma STT & Timbre TTS REST APIs (Exclusive Voice AI Engine)
  • Testing: pytest & pytest-asyncio

Frontend


๐Ÿ›๏ธ System Architecture

graph TD
    User(["Store Owner / Cashier"])
    
    subgraph Frontend ["Frontend (React 18 + Vite + TypeScript)"]
        UI["Retail Workspace & Navigation"]
        VoiceComp["Voice Assistant Modal (Multilingual)"]
        i18n["Localization Engine (te / hi / en / ta / kn / ml)"]
    end

    subgraph Backend ["Backend API (FastAPI)"]
        API["REST Router (/api/...)"]
        NLP["Voice NLP & Intent Parser"]
        SafetyGate["Financial Confirmation Gate"]
        Accounting["Double-Entry Ledger Engine"]
    end

    subgraph SpeechEngines ["Exclusive Voice Engine"]
        GnaniSTT["Gnani Prisma STT (Speech-to-Text)"]
        GnaniTTS["Gnani Timbre TTS (Text-to-Speech)"]
    end

    subgraph Persistence ["Persistence Layer"]
        DB[("SQLite Database (WAL Mode)")]
        Audit[("Audit & Fingerprint Log")]
    end

    User <-->|Voice / Touch| UI
    UI <--> VoiceComp
    VoiceComp <-->|Speech Stream| SpeechEngines
    VoiceComp -->|Structured Query| API
    UI -->|CRUD Requests| API
    API --> NLP
    NLP --> SafetyGate
    SafetyGate --> Accounting
    API --> Accounting
    Accounting --> DB
    Accounting --> Audit
Loading

๐Ÿ“‚ Repository Structure

BharatVoiceAI/
โ”œโ”€โ”€ backend/                        # FastAPI Python backend
โ”‚   โ”œโ”€โ”€ app/                        # Application source code
โ”‚   โ”‚   โ”œโ”€โ”€ accounts_service.py     # Cash drawer and settlement management
โ”‚   โ”‚   โ”œโ”€โ”€ auth.py                 # Multi-store API key authorization
โ”‚   โ”‚   โ”œโ”€โ”€ bill_import_service.py  # Bulk bill ingestion and duplicate detection
โ”‚   โ”‚   โ”œโ”€โ”€ database.py             # Database engine and sessionmaker
โ”‚   โ”‚   โ”œโ”€โ”€ finance_service.py      # Double-entry ledger and P&L calculations
โ”‚   โ”‚   โ”œโ”€โ”€ gnani_service.py        # Gnani AI Prisma STT & Timbre TTS integration
โ”‚   โ”‚   โ”œโ”€โ”€ main.py                 # FastAPI application routes and startup logic
โ”‚   โ”‚   โ”œโ”€โ”€ migrations.py           # Database migration runner
โ”‚   โ”‚   โ”œโ”€โ”€ models.py               # SQLAlchemy ORM models
โ”‚   โ”‚   โ”œโ”€โ”€ schemas.py              # Pydantic request and response schemas
โ”‚   โ”‚   โ”œโ”€โ”€ seed.py                 # Initial catalog and sales seed data
โ”‚   โ”‚   โ””โ”€โ”€ voice_service.py        # NLP entity extraction and intent mapping
โ”‚   โ”œโ”€โ”€ tests/                      # Pytest automated test suite (119 tests)
โ”‚   โ”œโ”€โ”€ .env.example                # Backend environment configuration template
โ”‚   โ”œโ”€โ”€ OPERATIONS.md               # Backend operational playbook
โ”‚   โ””โ”€โ”€ requirements.txt            # Python dependencies
โ”œโ”€โ”€ docs/                           # Documentation and visual architecture
โ”‚   โ”œโ”€โ”€ architecture.md             # Detailed engineering design specifications
โ”‚   โ””โ”€โ”€ screenshots/                # Application interface screenshots
โ”œโ”€โ”€ frontend/                       # React 18 + TypeScript frontend
โ”‚   โ”œโ”€โ”€ src/                        # UI source components
โ”‚   โ”‚   โ”œโ”€โ”€ App.tsx                 # Main application dashboard and tabs
โ”‚   โ”‚   โ”œโ”€โ”€ Onboarding.tsx          # Store setup and onboarding wizard
โ”‚   โ”‚   โ”œโ”€โ”€ i18n.tsx                # Multilingual translations and state
โ”‚   โ”‚   โ”œโ”€โ”€ api.ts                  # Typed API client
โ”‚   โ”‚   โ”œโ”€โ”€ types.ts                # Domain TypeScript interfaces
โ”‚   โ”‚   โ”œโ”€โ”€ onboarding.css          # Onboarding layout styling
โ”‚   โ”‚   โ””โ”€โ”€ styles.css              # Main workspace stylesheet
โ”‚   โ”œโ”€โ”€ .env.example                # Frontend environment configuration template
โ”‚   โ”œโ”€โ”€ package.json                # Node.js dependencies
โ”‚   โ”œโ”€โ”€ tsconfig.json               # TypeScript configuration
โ”‚   โ””โ”€โ”€ vite.config.ts              # Vite bundler configuration
โ”œโ”€โ”€ .env.example                    # Root environment configuration template
โ”œโ”€โ”€ .gitignore                      # Git exclusion rules (secrets, caches, builds)
โ”œโ”€โ”€ CONTRIBUTING.md                 # Contribution guidelines
โ”œโ”€โ”€ LICENSE                         # MIT License
โ”œโ”€โ”€ pytest.ini                      # Pytest discovery configuration
โ”œโ”€โ”€ README.md                       # Repository overview and documentation
โ”œโ”€โ”€ requirements.txt                # Root Python dependencies manifest
โ”œโ”€โ”€ start-backend.bat               # Windows backend startup script
โ”œโ”€โ”€ start-backend.sh                # Unix / Linux / macOS backend startup script
โ”œโ”€โ”€ start-frontend.bat              # Windows frontend startup script
โ””โ”€โ”€ start-frontend.sh               # Unix / Linux / macOS frontend startup script

๐Ÿ“ธ Screenshots & Demo

1. Centralized Retail Dashboard

Centralized Dashboard Real-time KPIs (Today's Sales, Completed Bills, Listed Products, Stock Alerts) and 7-day sales velocity chart.

2. Multilingual Voice Assistant & Financial Safety Gate

Voice Assistant & Safety Gate Voice assistant in Telugu (เฐคเฑ†เฐฒเฑเฐ—เฑ) with the Financial Safety Confirmation Gate intercepting financial operations.

3. Products Catalog & Itemized Tax Invoicing

Tax Invoicing Itemized tax invoice receipt modal with export bill (TXT), print, and CSV spreadsheet download capabilities.


๐Ÿš€ Installation & Setup

Prerequisites

  • Python 3.10+ (Python 3.11 recommended)
  • Node.js 18+ and npm 9+
  • Git

1. Clone the Repository

git clone https://github.com/itzPardhiv/BharatVoiceAI.git
cd BharatVoiceAI

2. Backend Setup

# Create and activate a Python virtual environment
python -m venv .venv

# On Windows:
.venv\Scripts\activate
# On Linux / macOS:
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Configure environment variables
cp .env.example .env

Tip

Add your GNANI_API_KEY and GNANI_ACCESS_KEY to .env to activate live neural voice transcription (Gnani Prisma STT) and voice synthesis (Gnani Timbre TTS).

3. Frontend Setup

cd frontend
npm install
cp .env.example .env
cd ..

๐Ÿ–ฅ๏ธ Running the Application

Automated Startup

Windows:

  • Double-click start-backend.bat (Starts FastAPI on http://127.0.0.1:8000)
  • Double-click start-frontend.bat (Starts Vite on http://localhost:5173)

Linux / macOS:

chmod +x start-backend.sh start-frontend.sh
./start-backend.sh &
./start-frontend.sh

Manual Startup

Terminal 1 (Backend):

python -m uvicorn app.main:app --app-dir backend --reload --port 8000
  • API Base URL: http://127.0.0.1:8000
  • Interactive Swagger Documentation: http://127.0.0.1:8000/docs

Terminal 2 (Frontend):

cd frontend
npm run dev
  • Web Application: http://localhost:5173

๐Ÿ’ฌ Usage Instructions & Voice Queries

Once the application is running, open http://localhost:5173 in your browser. Complete the initial 4-step onboarding or launch the Voice Assistant directly from the top-right header:

Sample Spoken Commands:

Language Spoken / Typed Query Meaning / Action Triggered
Telugu (te) "เฐˆ เฐฐเฑ‹เฐœเฑ เฐ…เฐฎเฑเฐฎเฐ•เฐพเฐฒเฑ เฐŽเฐ‚เฐค?" Queries today's gross sales and returns spoken Telugu audio.
Telugu (te) "เฐŸเฐพเฐŸเฐพ เฐธเฐพเฐฒเฑเฐŸเฑ เฐธเฑเฐŸเฐพเฐ•เฑ เฐŽเฐ‚เฐค?" Looks up current stock quantity for Tata Salt.
Hindi (hi) "เค†เคœ เค•เฅ€ เคฌเคฟเค•เฅเคฐเฅ€ เค•เคฟเคคเคจเฅ€ เคนเฅˆ?" Returns today's sales and completed bill count in Hindi.
Hindi (hi) "เค•เคฎ เคธเฅเคŸเฅ‰เค• เคตเคพเคฒเฅ‡ เค†เค‡เคŸเคฎ" Lists all products currently below their reorder threshold.
English (en) "Record an electricity expense of 500 rupees" Triggers the Financial Safety Gate; prompts user confirmation before committing.
English (en) "Add 10 packets of Sugar price 45" Creates an inventory addition bill and updates stock levels.

๐Ÿงช Running the Test Suite

The backend contains 119 automated unit, integration, and fault-injection tests validating API routes, double-entry ledgers, and NLP intent parsing:

# Run pytest directly from repository root
pytest

# Run with verbose output
pytest -v

Test Suite Coverage:

  • test_advanced_features.py (Advanced multi-item queries and ledger adjustments)
  • test_api_endpoints.py (REST contract testing across products, bills, summary)
  • test_bill_parser.py (Receipt parsing and line-item extraction)
  • test_database_models.py (SQLAlchemy schema constraints and foreign keys)
  • test_duplicate_detection.py (Tamper-evident fingerprint and double-billing guards)
  • test_e2e_and_fault_injection.py (Database disconnections and simulated network timeouts)
  • test_financial_integrity_and_acceptance.py (Debit/Credit ledger balance validation)
  • test_migrations.py (Schema migration resilience)
  • test_retail_and_voice.py (Multilingual intent and entity mapping)

๐Ÿ”ฎ Future Enhancements

  • WhatsApp Invoice Sharing: Automated PDF receipt delivery via WhatsApp Cloud API.
  • Offline Barcode Scanner Integration: Camera-based barcode and QR scanning for fast checkout.
  • Direct UPI Dynamic Soundbox: Audio confirmation webhook on real-time UPI payment settlement.
  • Federated Sync: Multi-store data synchronization between cloud PostgreSQL and local edge nodes.

๐Ÿ“„ License

This project is licensed under the MIT License.

About

Accessible, Voice-First Retail POS & Intelligence System for Indian Retailers & Differently-Abled Merchants. Exclusively powered by Gnani.ai (Prisma STT & Timbre TTS) with Double-Entry Ledger Safety.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages