Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ from pydantic import BaseModel
|
|
| 7 |
import torch
|
| 8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, pipeline
|
| 9 |
from fastapi.responses import HTMLResponse
|
|
|
|
| 10 |
# ---------------------------
|
| 11 |
# Logging setup
|
| 12 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
|
|
@@ -215,17 +216,22 @@ async def chat_endpoint(request: ChatRequest):
|
|
| 215 |
@app.get("/", response_class=HTMLResponse)
|
| 216 |
async def root():
|
| 217 |
return """
|
|
|
|
| 218 |
<html>
|
| 219 |
-
<head>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
<body>
|
| 221 |
-
<h1>
|
| 222 |
-
<p>
|
| 223 |
-
<ul>
|
| 224 |
-
<li><a href="/health">Health Check</a></li>
|
| 225 |
-
<li><a href="/docs">Interactive API Docs</a></li>
|
| 226 |
-
<li>POST to /chat: {"message": "Your prompt"}</li>
|
| 227 |
</ul>
|
| 228 |
-
<p>
|
| 229 |
</body>
|
| 230 |
</html>
|
| 231 |
"""
|
|
|
|
| 7 |
import torch
|
| 8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, pipeline
|
| 9 |
from fastapi.responses import HTMLResponse
|
| 10 |
+
|
| 11 |
# ---------------------------
|
| 12 |
# Logging setup
|
| 13 |
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
|
|
|
|
| 216 |
@app.get("/", response_class=HTMLResponse)
|
| 217 |
async def root():
|
| 218 |
return """
|
| 219 |
+
<!DOCTYPE html>
|
| 220 |
<html>
|
| 221 |
+
<head>
|
| 222 |
+
<title>Personality Bot API - Elias Aariz al-Hakim</title>
|
| 223 |
+
<meta charset="utf-8">
|
| 224 |
+
<style>body { font-family: Arial; text-align: center; margin: 50px; }</style>
|
| 225 |
+
</head>
|
| 226 |
<body>
|
| 227 |
+
<h1>🚀 Purposeful Architect Bot Live!</h1>
|
| 228 |
+
<p>Emulates reflective, structured personality—bilingual Urdu/English chats.</p>
|
| 229 |
+
<ul style="text-align: left; display: inline-block;">
|
| 230 |
+
<li><a href="/health">Health Check (loads model)</a></li>
|
| 231 |
+
<li><a href="/docs">Interactive API Docs (Swagger UI)</a></li>
|
| 232 |
+
<li>POST to /chat: <code>{"message": "Your prompt"}</code></li>
|
| 233 |
</ul>
|
| 234 |
+
<p>Tip: Use curl or Python for /chat tests.</p>
|
| 235 |
</body>
|
| 236 |
</html>
|
| 237 |
"""
|