Spaces:
Sleeping
Sleeping
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
- Message @BotFather →
/newbot→ get token - Set bot token in HF Secrets
- 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:
- Send
/start - Send a
.csvfile - 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