Personal ProjectAI & LLMs~3 min read

Gold Investment Estimations Assistant

Voice-enabled precious metals calculator and market advisor on Hugging Face Spaces.

RoleAI Developer
TimelineAug 2025
DomainAI & LLMs
Core StackPython, Gradio, Google Gemini

Why I Built It#

I built this project to experiment with voice interfaces for practical financial calculators. In many countries, gold is bought and sold across different regional units (grams, tolas, troy ounces) and purities (24K, 22K, 18K, 14K). On top of that, jewellers add fabrication charges and local taxes, making it difficult for an average buyer to figure out how much raw metal value they are actually getting.

I wanted to build an easy tool where someone could either speak or type their gold holdings, see the exact breakdown of metal value versus making fees, and get advice on physical bullion versus paper gold.

The app is deployed live on Hugging Face Spaces.

Gold Investment Assistant Interface
Click to view fullscreen
Gold Investment Assistant Interface

How It Works#

The application combines speech-to-text, mathematical normalization, and an LLM advisory engine:

architecture-diagram.txt
Voice Input / Text Query
          │
          ▼
┌──────────────────────────────────────────┐
│         Gradio Web Interface             │ (Hosted on Hugging Face Spaces)
└──────────────────┬───────────────────────┘
                   │
      Voice Audio? ├──────────────────────────┐
                   ▼                          ▼
┌───────────────────────────┐      ┌───────────────────────────┐
│       Groq Whisper        │      │    Python Math Engine     │
│    (whisper-large-v3)     │      │ (Normalizes units/karats  │
└────────────┬──────────────┘      │  to pure grams & charges) │
             │                     └───────────┬───────────────┘
             ▼                                 │
     Transcribed Text                          │
             │                                 │
             └───────────────┬─────────────────┘
                             ▼
┌──────────────────────────────────────────┐
│        Google Gemini via OpenAI SDK      │ (Investment Strategy & Advisory)
└──────────────────┬───────────────────────┘
                   │
                   ▼
┌──────────────────────────────────────────┐
│      Valuation Table & Advisory Note     │
└──────────────────────────────────────────┘
  1. 01
    Voice Input via Groq Whisper: Users can tap the microphone to ask a question (for example, "What is 2 tolas of 22K gold worth right now with 10% making charges?"). The audio is transcribed by Groq's cloud-hosted Whisper model (whisper-large-v3), which returns text in under 400 milliseconds.
  2. 02
    Deterministic Calculations: Instead of asking an LLM to calculate prices, pure Python handles all math. It converts units (1 tola = 11.6638 grams; 1 troy oz = 31.1035 grams) and scales for karat purity (22K = 91.6%, 18K = 75.0%) to calculate fine gold weight, spot value, and itemized making charges.
  3. 03
    AI Investment Advisory: The calculated breakdown is passed to Google Gemini (configured using the OpenAI Python SDK pointing to Google's OpenAI-compatible endpoint). Gemini returns a concise note comparing physical bullion holdings, liquidity spreads, and gold ETFs.

Technical Lessons#

  • Low-latency transcription makes voice usable: Running Whisper locally on free-tier cloud CPU instances took 6 to 8 seconds per query. Switching to Groq's hosted Whisper API dropped latency to less than half a second, which made speaking feel natural.
  • Always keep math deterministic: Calculating financial values in Python code guarantees exact, reliable numbers, while leaving the language model to do what it is good at—providing explanations and context.

Complete Technology Stack

PythonGradioGoogle GeminiGroq WhisperOpenAI SDK