ManjotSingh commited on
Commit
fc34500
1 Parent(s): a8c35e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -25
app.py CHANGED
@@ -13,7 +13,7 @@ class MyApp:
13
  self.documents = []
14
  self.embeddings = None
15
  self.index = None
16
- self.load_pdf("YOURPDFFILE.pdf")
17
  self.build_vector_db()
18
 
19
  def load_pdf(self, file_path: str) -> None:
@@ -58,7 +58,7 @@ def respond(
58
  temperature: float,
59
  top_p: float,
60
  ):
61
- system_message = "You are a knowledgeable DBT coach. You always talk about one options at at a time. you add greetings and you ask questions like real counsellor. Remember you are helpful and a good listener. You are concise and never ask multiple questions, or give long response. You response like a human counsellor accurately and correctly. consider the users as your client. and practice verbal cues only where needed. Remember you must be respectful and consider that the user may not be in a situation to deal with a wordy chatbot. You Use DBT book to guide users through DBT exercises and provide helpful information. When needed only then you ask one follow up question at a time to guide the user to ask appropiate question. You avoid giving suggestion if any dangerous act is mentioned by the user and refer to call someone or emergency."
62
  messages = [{"role": "system", "content": system_message}]
63
 
64
  for val in history:
@@ -86,29 +86,30 @@ def respond(
86
  response += token
87
  yield response
88
 
89
- demo = gr.Blocks()
90
-
91
- with demo:
92
- gr.Markdown("🧘‍♀️ **Dialectical Behaviour Therapy**")
93
- gr.Markdown(
94
- "‼️Disclaimer: This chatbot is based on a DBT exercise book that is publicly available. "
95
- "We are not medical practitioners, and the use of this chatbot is at your own responsibility.‼️"
96
- )
97
-
98
- chatbot = gr.ChatInterface(
99
- respond,
100
- examples=[
101
- ["I feel overwhelmed with work."],
102
- ["Can you guide me through a quick meditation?"],
103
- ["How do I stop worrying about things I can't control?"],
104
- ["What are some DBT skills for managing anxiety?"],
105
- ["Can you explain mindfulness in DBT?"],
106
- ["I am interested in DBT excercises"],
107
- ["I feel restless. Please help me."],
108
- ["I have destructive thoughts coming to my mind repetatively."]
109
- ],
110
- title='Dialectical Behaviour Therapy Assistant 👩‍⚕️'
111
- )
 
112
 
113
  if __name__ == "__main__":
114
  demo.launch()
 
13
  self.documents = []
14
  self.embeddings = None
15
  self.index = None
16
+ self.load_pdf("North_Indian_Diet.pdf")
17
  self.build_vector_db()
18
 
19
  def load_pdf(self, file_path: str) -> None:
 
58
  temperature: float,
59
  top_p: float,
60
  ):
61
+ system_message = "You are a North Indian diet expert. You provide dietary advice, suggest meal plans, and answer questions related to North Indian cuisine and nutrition. Feel free to ask about healthy recipes, nutritional benefits of foods, or meal planning tips."
62
  messages = [{"role": "system", "content": system_message}]
63
 
64
  for val in history:
 
86
  response += token
87
  yield response
88
 
89
+ demo = gr.ChatInterface(
90
+ respond,
91
+ additional_inputs=[
92
+ gr.Textbox(
93
+ value="You are a North Indian diet expert. You provide dietary advice, suggest meal plans, and answer questions related to North Indian cuisine and nutrition. Feel free to ask about healthy recipes, nutritional benefits of foods, or meal planning tips.",
94
+ label="System message"
95
+ ),
96
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
97
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
98
+ gr.Slider(
99
+ minimum=0.1,
100
+ maximum=1.0,
101
+ value=0.95,
102
+ step=0.05,
103
+ label="Top-p (nucleus sampling)"
104
+ ),
105
+ ],
106
+ examples=[
107
+ ["Can you suggest a healthy North Indian breakfast?"],
108
+ ["What are the nutritional benefits of chickpeas?"],
109
+ ["How can I plan a balanced North Indian meal?"]
110
+ ],
111
+ title='North Indian Diet Expert 🍛'
112
+ )
113
 
114
  if __name__ == "__main__":
115
  demo.launch()