Skip to content
23sarPublic
forked from yq-keys/OpenQuery

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

OpenQuery

An Open Query Platform that lets you ask any question using voice or text and receive answers in text or cloned voice. It supports querying uploaded files (PDF, DOCX, XLSX, TXT, CSV, Markdown, code), live web search, and general knowledge, with Indian English speech synthesis and OpenVoice V2 voice cloning.

Tech Stack

  • Backend: Python, FastAPI, Uvicorn
  • File Parsing: PyPDF2, python-docx, openpyxl
  • Embeddings & Vector Search: sentence-transformers (all-MiniLM-L6-v2), FAISS (IndexFlatIP)
  • Web Search: ddgs with Wikipedia Search API fallback
  • LLM: Google Gemini (gemini-3.6-flash with fallback to gemini-3.8-flash / gemini-3.5-flash-lite)
  • Speech-to-Text: faster-whisper (base, CPU int8)
  • Text-to-Speech & Voice Cloning: MeloTTS (EN_INDIA) + OpenVoice V2 (ToneColorConverter)
  • Frontend: HTML, CSS, JavaScript (Web Audio API 16 kHz WAV recording)

Project Structure

OpenQuery/
├── app/
│   ├── __init__.py
│   ├── main.py              # FastAPI routes and request handling
│   ├── pdf_processor.py     # Multi-format file text extraction and chunking
│   ├── vector_store.py      # FAISS vector store and similarity search
│   ├── web_search.py        # Web search and query mode routing
│   ├── qa_engine.py         # Prompt building, Gemini calls, speech text cleanup
│   ├── voice_engine.py      # STT, voice training, MeloTTS + OpenVoice V2 cloning
│   └── static/
│       └── index.html       # Web UI
├── uploads/                 # Uploaded files (in-memory index)
├── voices/                  # Saved voice profiles and embeddings
├── audio_output/            # Temporary generated audio
├── setup.sh                 # Automated environment setup script (macOS/Linux)
├── requirements.txt
├── .env.example
└── README.md

Setup on a New Device

Prerequisites

Quick Setup (macOS / Linux)

git clone https://github.com/yq-keys/OpenQuery.git
cd OpenQuery
chmod +x setup.sh
./setup.sh

Then open .env and add your API key:

GOOGLE_API_KEY=your-key-here

Manual Setup (macOS / Linux / Windows)

  1. Clone the repository and external voice repositories:
git clone https://github.com/yq-keys/OpenQuery.git
cd OpenQuery
git clone https://github.com/myshell-ai/OpenVoice.git
git clone https://github.com/myshell-ai/MeloTTS.git
  1. Create a virtual environment and install dependencies:

macOS / Linux:

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Windows (PowerShell):

python -m venv venv
.\venv\Scripts\Activate.ps1
pip install -r requirements.txt
  1. Configure your Gemini API key:
cp .env.example .env

Edit .env and set:

GOOGLE_API_KEY=your-key-here

Run

uvicorn app.main:app --reload --port 8000

Open http://localhost:8000 in your browser.

Notes:

  • On first speech generation or voice training, OpenVoice V2 (myshell-ai/OpenVoiceV2), MeloTTS, faster-whisper, and Silero VAD models download automatically. An internet connection is required for the first run.
  • You can ask questions right away without uploading files, or upload .pdf, .docx, .xlsx, .txt, .md, .csv, .json, or code files in the sidebar.
  • Use Mode (Auto, Always Files + Web, Web Search Only, Uploaded Files Only) in the header to control where answers are sourced from.
  • Upload one or more 10–30 second audio clips under Voice Profiles to train or expand a custom voice profile.

API Endpoints

Method Endpoint Description
GET / Serves the web UI
POST /upload Upload and index a supported document or file
POST /ask Ask a question (files, web search, or both) with optional voice output
POST /transcribe Transcribe microphone audio to text
POST /ask/voice Voice-in, Q&A, and voice-out in one request
POST /voices/train Train or add clips to a voice profile
GET /voices List trained voice profiles
DELETE /voices/{name} Delete a voice profile
GET /status List uploaded files and chunk count
DELETE /reset Clear uploaded files and reset the vector store

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages