ewssbd commited on
Commit
8fd3cf3
·
verified ·
1 Parent(s): 7501278

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -19,10 +19,19 @@ chatbot = pipeline(
19
  set_seed(42)
20
  print("✅ Model loaded and ready!")
21
 
 
 
 
 
 
 
 
 
 
22
  # ---------------------------
23
  # Step 2: FastAPI app setup
24
  # ---------------------------
25
- app = FastAPI(title="Tiny Model Chatbot API", version="1.0")
26
 
27
  # ---------------------------
28
  # Step 3: Predict endpoint
@@ -37,6 +46,7 @@ async def predict(request: Request):
37
  return JSONResponse({"error": "Missing 'message' in request."}, status_code=400)
38
 
39
  messages = [
 
40
  {"role": "user", "content": user_input},
41
  {"role": "assistant", "content": ""}
42
  ]
@@ -67,7 +77,7 @@ async def predict(request: Request):
67
  # ---------------------------
68
  @app.get("/")
69
  def home():
70
- return {"message": "Tiny Chatbot API is running!"}
71
 
72
  # ---------------------------
73
  # Step 5: Run locally (ignored on Hugging Face)
 
19
  set_seed(42)
20
  print("✅ Model loaded and ready!")
21
 
22
+ # ---------------------------
23
+ # Step Dryfish: System instruction
24
+ # ---------------------------
25
+ SYSTEM_INSTRUCTION = (
26
+ "You are DryfishBD's chat assistant. "
27
+ "Your goal is to help customers with inquiries about dried fish products, shipping, orders, pricing, and recommendations. "
28
+ "Always reply in a friendly, professional, and concise manner."
29
+ )
30
+
31
  # ---------------------------
32
  # Step 2: FastAPI app setup
33
  # ---------------------------
34
+ app = FastAPI(title="DryfishBD Chatbot API", version="1.0")
35
 
36
  # ---------------------------
37
  # Step 3: Predict endpoint
 
46
  return JSONResponse({"error": "Missing 'message' in request."}, status_code=400)
47
 
48
  messages = [
49
+ {"role": "system", "content": SYSTEM_INSTRUCTION},
50
  {"role": "user", "content": user_input},
51
  {"role": "assistant", "content": ""}
52
  ]
 
77
  # ---------------------------
78
  @app.get("/")
79
  def home():
80
+ return {"message": "DryfishBD Chatbot API is running!"}
81
 
82
  # ---------------------------
83
  # Step 5: Run locally (ignored on Hugging Face)