--- 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 ```bash pip install fastapi uvicorn transformers torch accelerate sentencepiece ``` --- ### 2๏ธโƒฃ Run server ```bash uvicorn main:app --host 0.0.0.0 --port 8000 ``` For Colab: ```bash nohup uvicorn main:app --host 0.0.0.0 --port 8000 & ``` --- ## ๐ŸŒ API Usage ### ๐Ÿ”น General Chat ```bash POST /chat ``` ```json { "message": "Hello, what is AI?", "mode": "none" } ``` --- ### ๐Ÿ”น English Mode ```bash POST /english ``` ```json { "message": "Correct this sentence: I has a book" } ``` --- ### ๐Ÿ”น Bangla Mode ```bash POST /bangla ``` ```json { "message": "เฆฌเฆพเฆ‚เฆฒเฆพ เฆฌเงเฆฏเฆพเฆ•เฆฐเฆฃ เฆ•เฆฟ?" } ``` --- ### ๐Ÿ”น Math Mode ```bash POST /math ``` ```json { "message": "Solve: 2x + 5 = 15" } ``` --- ### ๐Ÿ”น Physics Mode ```bash POST /physics ``` ```json { "message": "Explain Newton's second law" } ``` --- ## ๐Ÿงพ Response Format ```json { "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/](https://www.linkedin.com/in/saib-hossain-182834229/) --- ## ๐Ÿš€ Deployment (Hugging Face Spaces) 1. Create a new Space 2. Choose **Docker or Gradio SDK** 3. Upload `main.py` 4. Set runtime to Python 3.10+ 5. 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/](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.