Spaces:
Sleeping
Sleeping
Commit ·
adbe673
1
Parent(s): bdae06b
Deploy FastAPI chatbot with multi-mode endpoints
Browse files
app.py
CHANGED
|
@@ -14,12 +14,35 @@ pipe = pipeline(
|
|
| 14 |
|
| 15 |
# Disclaimer
|
| 16 |
DISCLAIMER = """
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
---
|
| 19 |
-
The chat interface is built by MD Saib Hossain.
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
"""
|
| 24 |
|
| 25 |
# Request Model
|
|
@@ -61,7 +84,7 @@ Assistant:
|
|
| 61 |
# -----------------------------
|
| 62 |
# Default Chat Endpoint
|
| 63 |
# -----------------------------
|
| 64 |
-
@app.post("/chat")
|
| 65 |
async def general_chat(req: ChatRequest):
|
| 66 |
|
| 67 |
system_prompt = """
|
|
@@ -80,7 +103,7 @@ Answer all kinds of questions politely and clearly.
|
|
| 80 |
# -----------------------------
|
| 81 |
# English Endpoint
|
| 82 |
# -----------------------------
|
| 83 |
-
@app.post("/english")
|
| 84 |
async def english_chat(req: ChatRequest):
|
| 85 |
|
| 86 |
system_prompt = """
|
|
@@ -110,7 +133,7 @@ reply:
|
|
| 110 |
# -----------------------------
|
| 111 |
# Bangla Endpoint
|
| 112 |
# -----------------------------
|
| 113 |
-
@app.post("/bangla")
|
| 114 |
async def bangla_chat(req: ChatRequest):
|
| 115 |
|
| 116 |
system_prompt = """
|
|
@@ -139,7 +162,7 @@ reply:
|
|
| 139 |
# -----------------------------
|
| 140 |
# Math Endpoint
|
| 141 |
# -----------------------------
|
| 142 |
-
@app.post("/math")
|
| 143 |
async def math_chat(req: ChatRequest):
|
| 144 |
|
| 145 |
system_prompt = """
|
|
@@ -172,7 +195,7 @@ reply:
|
|
| 172 |
# -----------------------------
|
| 173 |
# Physics Endpoint
|
| 174 |
# -----------------------------
|
| 175 |
-
@app.post("/physics")
|
| 176 |
async def physics_chat(req: ChatRequest):
|
| 177 |
|
| 178 |
system_prompt = """
|
|
|
|
| 14 |
|
| 15 |
# Disclaimer
|
| 16 |
DISCLAIMER = """
|
| 17 |
+
<div style="text-align: center; font-size: 0.9em; color: #666; margin-bottom: 20px;">
|
| 18 |
+
<strong>⚠️ AI Study Assistant Notice</strong><br>
|
| 19 |
+
This AI chatbot is here to help you study and learn! However, AI can sometimes make mistakes. Always double-check important facts and deadlines with your teacher or course materials. <br><em>For your privacy, please do not share personal information or student IDs in this chat.</em>
|
| 20 |
+
</div>
|
| 21 |
|
| 22 |
---
|
|
|
|
| 23 |
|
| 24 |
+
### 👨💻 Author
|
| 25 |
+
**Md Saib Hossain**
|
| 26 |
+
*AI Engineer • AI Safety Researcher • Agentic AI Architect*
|
| 27 |
+
|
| 28 |
+
*Designing safe, scalable, and human-centered intelligent systems.*
|
| 29 |
+
|
| 30 |
+
Looking to build custom chat interfaces, educational AI systems, or RAG-based chatbots? Let's connect:
|
| 31 |
+
|
| 32 |
+
<p align="left">
|
| 33 |
+
<a href="mailto:saibhossain5@gmail.com">
|
| 34 |
+
<img src="https://img.shields.io/badge/Email-saibhossain5%40gmail.com-red?style=flat&logo=gmail" alt="Email">
|
| 35 |
+
</a>
|
| 36 |
+
<a href="https://linkedin.com/in/saib-hossain-182834229">
|
| 37 |
+
<img src="https://img.shields.io/badge/LinkedIn-Connect-0A66C2?style=flat&logo=linkedin" alt="LinkedIn">
|
| 38 |
+
</a>
|
| 39 |
+
<a href="https://github.com/Saibhossain">
|
| 40 |
+
<img src="https://img.shields.io/badge/GitHub-Profile-black?style=flat&logo=github" alt="GitHub">
|
| 41 |
+
</a>
|
| 42 |
+
<a href="https://saibhossain.github.io/">
|
| 43 |
+
<img src="https://img.shields.io/badge/Portfolio-Visit-blue?style=flat&logo=google-chrome" alt="Portfolio">
|
| 44 |
+
</a>
|
| 45 |
+
</p>
|
| 46 |
"""
|
| 47 |
|
| 48 |
# Request Model
|
|
|
|
| 84 |
# -----------------------------
|
| 85 |
# Default Chat Endpoint
|
| 86 |
# -----------------------------
|
| 87 |
+
@app.post("/api/chat")
|
| 88 |
async def general_chat(req: ChatRequest):
|
| 89 |
|
| 90 |
system_prompt = """
|
|
|
|
| 103 |
# -----------------------------
|
| 104 |
# English Endpoint
|
| 105 |
# -----------------------------
|
| 106 |
+
@app.post("/api/english")
|
| 107 |
async def english_chat(req: ChatRequest):
|
| 108 |
|
| 109 |
system_prompt = """
|
|
|
|
| 133 |
# -----------------------------
|
| 134 |
# Bangla Endpoint
|
| 135 |
# -----------------------------
|
| 136 |
+
@app.post("/api/bangla")
|
| 137 |
async def bangla_chat(req: ChatRequest):
|
| 138 |
|
| 139 |
system_prompt = """
|
|
|
|
| 162 |
# -----------------------------
|
| 163 |
# Math Endpoint
|
| 164 |
# -----------------------------
|
| 165 |
+
@app.post("/api/math")
|
| 166 |
async def math_chat(req: ChatRequest):
|
| 167 |
|
| 168 |
system_prompt = """
|
|
|
|
| 195 |
# -----------------------------
|
| 196 |
# Physics Endpoint
|
| 197 |
# -----------------------------
|
| 198 |
+
@app.post("/api/physics")
|
| 199 |
async def physics_chat(req: ChatRequest):
|
| 200 |
|
| 201 |
system_prompt = """
|