Utkarsh Verma commited on
Commit
460380b
Β·
1 Parent(s): 65d1591

Code Change

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -22,15 +22,16 @@ def chat():
22
  return jsonify({"error": "Empty message received"})
23
 
24
  try:
 
25
  payload = {
26
- "inputs": user_message,
27
- "parameters": {
28
- "temperature": 0.5, # πŸ”₯ Controls randomness (lower = more deterministic)
29
- "top_p": 0.9, # 🎯 Focus on high-probability words
30
- "max_new_tokens": 50, # ⏳ Limits response length
31
- "stop_sequences": ["\nUser:", "[INST]"] # β›” Stops response at natural points
 
32
  }
33
- }
34
  response = requests.post(API_URL, headers=headers, json=payload)
35
  data = response.json()
36
  # print(response.status_code) # Debugging: Print the HTTP status
 
22
  return jsonify({"error": "Empty message received"})
23
 
24
  try:
25
+ formatted_prompt = f"User: {user_message}\nBot:"
26
  payload = {
27
+ "inputs": formatted_prompt,
28
+ "parameters": {
29
+ "temperature": 0.5,
30
+ "top_p": 0.9,
31
+ "max_new_tokens": 100,
32
+ "stop_sequences": ["\nUser:", "User:", "\n"]
33
+ }
34
  }
 
35
  response = requests.post(API_URL, headers=headers, json=payload)
36
  data = response.json()
37
  # print(response.status_code) # Debugging: Print the HTTP status