safwansajad commited on
Commit
e40b09d
·
verified ·
1 Parent(s): 003178d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -1,13 +1,14 @@
1
  from llama_cpp import Llama
2
  import gradio as gr
3
 
4
- # Load the GGUF model (quantized, small model)
5
  llm = Llama(
6
- model_path="mental-health-chatbot-i1.Q4_K_M.gguf", # change filename if using a different quant
7
  n_ctx=2048,
8
- n_threads=4, # adjust based on your Space CPU
9
  )
10
 
 
11
  def chat(message, history):
12
  full_prompt = ""
13
  for user, bot in history:
@@ -18,5 +19,7 @@ def chat(message, history):
18
  reply = output["choices"][0]["text"].strip()
19
  return reply
20
 
21
- # Simple chat UI
22
- gr.ChatInterface(fn=chat).launch()
 
 
 
1
  from llama_cpp import Llama
2
  import gradio as gr
3
 
4
+ # Load GGUF model
5
  llm = Llama(
6
+ model_path="mental-health-chatbot-i1.Q4_K_M.gguf", # Make sure this filename matches exactly
7
  n_ctx=2048,
8
+ n_threads=4,
9
  )
10
 
11
+ # Chat logic
12
  def chat(message, history):
13
  full_prompt = ""
14
  for user, bot in history:
 
19
  reply = output["choices"][0]["text"].strip()
20
  return reply
21
 
22
+ # Chat Interface
23
+ gr.ChatInterface(fn=chat, title="Mental Health Llama Chatbot").launch(
24
+ server_name="0.0.0.0", server_port=7860
25
+ )