nilotpal-sql-bot / README.md
nilotpaldhar2004's picture
Update README.md
c5b1a0a unverified
metadata
title: Nilotpal SQL Bot
emoji: 
colorFrom: blue
colorTo: indigo
sdk: docker
pinned: false
license: mit
app_port: 7860

⚡ Nilotpal SQL Bot

A Telegram bot + Web App that converts plain English to SQL and queries your CSV data instantly.

Features

Feature Standard Telegram Msg Telegram Web App
HTML/CSS Support ❌ None ✅ Full
Interactive Buttons ✅ Yes ✅ Yes
Complexity Low High
Professional Feel Good Premium

Setup (Two Steps)

Step 1 — HuggingFace Space Secrets

In your Space → Settings → Variables and secrets, add:

Key Value
BOT_TOKEN Your Telegram bot token from @BotFather
SPACE_URL https://nilotpaldhar2004-nilotpal-sql-bot.hf.space
WEBHOOK_SECRET Any secret string (e.g. nilotpalsqlbot)

Step 2 — Telegram Bot Setup

  1. Message @BotFather → /newbot → get token
  2. Set bot token in HF Secrets
  3. Deploy Space → webhook auto-registers on startup

Step 3 — Enable Web App in BotFather

/newapp → select your bot → set URL to:
https://nilotpaldhar2004-nilotpal-sql-bot.hf.space/webapp

Usage

Via Telegram Bot:

  1. Send /start
  2. Send a .csv file
  3. Ask questions in plain English

Via Web App:

  • Tap "Open Web App" button in bot
  • Full HTML/CSS premium interface
  • Upload CSV + chat with data

Tech Stack

  • FastAPI + Python
  • HuggingFace Transformers (T5-small text-to-SQL)
  • SQLite (in-memory per session)
  • Telegram Bot API + Web App API
  • Docker on HuggingFace Spaces

File Structure

nilotpal-sql-bot/
├── app.py              ← FastAPI backend + Telegram webhook
├── static/
│   └── webapp.html     ← Telegram Web App UI
├── requirements.txt
├── Dockerfile
└── README.md