hiwa27 commited on
Commit
dc469be
·
verified ·
1 Parent(s): 8a06047

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -11
app.py CHANGED
@@ -9,15 +9,8 @@ client = InferenceClient(
9
  api_key=os.environ["HF_TOKEN"]
10
  )
11
 
12
- SYSTEM_PROMPT = """
13
- You are WALAM AI.
14
- Reply clearly and helpfully.
15
- Prefer Kurdish Sorani when the user writes in Kurdish.
16
- Keep answers practical and concise.
17
- """
18
-
19
  def chat(message, history):
20
- messages = [{"role": "system", "content": SYSTEM_PROMPT}]
21
 
22
  for user_msg, bot_msg in history:
23
  messages.append({"role": "user", "content": user_msg})
@@ -28,15 +21,15 @@ def chat(message, history):
28
  response = client.chat.completions.create(
29
  model=MODEL,
30
  messages=messages,
31
- max_tokens=300,
32
  )
33
 
34
  return response.choices[0].message.content
35
 
36
  demo = gr.ChatInterface(
37
  fn=chat,
38
- title="WALAM AI",
39
- description="Smart chatbot powered by Hugging Face"
40
  )
41
 
42
  demo.launch()
 
9
  api_key=os.environ["HF_TOKEN"]
10
  )
11
 
 
 
 
 
 
 
 
12
  def chat(message, history):
13
+ messages = []
14
 
15
  for user_msg, bot_msg in history:
16
  messages.append({"role": "user", "content": user_msg})
 
21
  response = client.chat.completions.create(
22
  model=MODEL,
23
  messages=messages,
24
+ max_tokens=200,
25
  )
26
 
27
  return response.choices[0].message.content
28
 
29
  demo = gr.ChatInterface(
30
  fn=chat,
31
+ title="WALAM AI 🤖",
32
+ description="Free AI Chatbot"
33
  )
34
 
35
  demo.launch()