Spaces:
Sleeping
Download README.md from saibhossain/Chat_API: direct link, hf CLI and curl.
- Browser
- Download file 3.7 kB
-
https://huggingface.co/spaces/saibhossain/Chat_API/resolve/main/README.md
- Command line
-
hf download hf://spaces/saibhossain/Chat_API/README.md
-
curl -L -o README.md https://huggingface.co/spaces/saibhossain/Chat_API/resolve/main/README.md
title: Chat API - Multi Mode AI
emoji: π€
colorFrom: blue
colorTo: purple
sdk: docker
app_file: app.py
pinned: false
π€ Multimodal AI Chatbot API (FastAPI + Hugging Face + Qwen2.5)
This project is a FastAPI-based AI chatbot backend designed for deployment on Google Colab + Hugging Face Spaces. It uses a lightweight LLM (Qwen2.5-1.5B-Instruct) and provides multiple domain-specific AI endpoints.
π Features
β‘ FastAPI backend for high-performance inference
π§ Powered by
Qwen2.5-1.5B-Instruct(lightweight LLM)π Multiple specialized AI modes:
- English assistant
- Bangla assistant
- Math solver
- Physics tutor
π REST API ready for frontend integration
π¦ Hugging Face / Colab deployment friendly
π Project Structure
main.py # FastAPI backend
requirements.txt
README.md
π§ AI Modes / Endpoints
| Mode | Endpoint | Description |
|---|---|---|
| General | /chat |
General AI assistant |
| English | /english |
Grammar, writing, correction |
| Bangla | /bangla |
Bangla language assistant |
| Math | /math |
Step-by-step problem solving |
| Physics | /physics |
Physics explanations & numericals |
βοΈ Installation (Local / Colab)
1οΈβ£ Install dependencies
pip install fastapi uvicorn transformers torch accelerate sentencepiece
2οΈβ£ Run server
uvicorn main:app --host 0.0.0.0 --port 8000
For Colab:
nohup uvicorn main:app --host 0.0.0.0 --port 8000 &
π API Usage
πΉ General Chat
POST /chat
{
"message": "Hello, what is AI?",
"mode": "none"
}
πΉ English Mode
POST /english
{
"message": "Correct this sentence: I has a book"
}
πΉ Bangla Mode
POST /bangla
{
"message": "বাΰ¦ΰ¦²ΰ¦Ύ বΰ§ΰ¦―ΰ¦Ύΰ¦ΰ¦°ΰ¦£ ΰ¦ΰ¦Ώ?"
}
πΉ Math Mode
POST /math
{
"message": "Solve: 2x + 5 = 15"
}
πΉ Physics Mode
POST /physics
{
"message": "Explain Newton's second law"
}
π§Ύ Response Format
{
"mode": "math",
"response": "Step-by-step solution..."
}
π Disclaimer (Included in every response)
Each response automatically includes:
The chat interface is built by MD Saib Hossain. For AI systems, RAG pipelines, or Agentic AI development contact: https://www.linkedin.com/in/saib-hossain-182834229/
π Deployment (Hugging Face Spaces)
- Create a new Space
- Choose Docker or Gradio SDK
- Upload
main.py - Set runtime to Python 3.10+
- Add dependencies in
requirements.txt
π₯ Tech Stack
- FastAPI
- Hugging Face Transformers
- PyTorch
- Qwen2.5 LLM
- Google Colab (for development)
π Future Improvements
- π₯ Streaming responses (token-by-token)
- π₯ LangGraph-based routing
- π₯ RAG integration (PDF + web data)
- π₯ Memory-based chat system
- π₯ Frontend React UI integration
π¨βπ» Author
MD Saib Hossain AI/ML Engineer | Agentic AI & RAG Systems Builder
π LinkedIn: https://www.linkedin.com/in/saib-hossain-182834229/
β If you like this project
You can extend it into:
- AI tutor system
- Multilingual chatbot
- Exam preparation assistant
- Medical/education RAG system
π Built for scalable AI experimentation on lightweight infrastructure.