Spaces:
Sleeping
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
3.7 kB
| 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. | |