SaiPrakashTut commited on
Commit
36931af
·
verified ·
1 Parent(s): d67306e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  from typing import List, Tuple
4
- import fitz # PyMuPDF
5
  from sentence_transformers import SentenceTransformer
6
  import numpy as np
7
  import faiss
@@ -15,7 +15,7 @@ class MyApp:
15
  self.documents = []
16
  self.embeddings = None
17
  self.index = None
18
- self.load_pdf("THEDIA1.pdf")
19
  self.build_vector_db()
20
 
21
  def load_pdf(self, file_path: str) -> None:
@@ -66,7 +66,7 @@ def shorten_response(response: str) -> str:
66
  return result.choices[0].message['content'].strip()
67
 
68
  def respond(message: str, history: List[Tuple[str, str]]):
69
- system_message = "You are a supportive and empathetic Dialectical Behaviour Therapist assistant. You politely guide users through DBT exercises based on the given DBT book. You must say one thing at a time and ask follow-up questions to continue the chat."
70
  messages = [{"role": "system", "content": system_message}]
71
 
72
  for val in history:
@@ -94,10 +94,10 @@ def respond(message: str, history: List[Tuple[str, str]]):
94
  return history, ""
95
 
96
  with gr.Blocks() as demo:
97
- gr.Markdown("# 🧘‍♀️ **Dialectical Behaviour Therapy**")
98
  gr.Markdown(
99
- "‼️Disclaimer: This chatbot is based on a DBT exercise book that is publicly available. "
100
- "We are not medical practitioners, and the use of this chatbot is at your own responsibility."
101
  )
102
 
103
  chatbot = gr.Chatbot()
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
  from typing import List, Tuple
4
+ import fitz
5
  from sentence_transformers import SentenceTransformer
6
  import numpy as np
7
  import faiss
 
15
  self.documents = []
16
  self.embeddings = None
17
  self.index = None
18
+ self.load_pdf("complaint_duration_root_cause_summary.pdf")
19
  self.build_vector_db()
20
 
21
  def load_pdf(self, file_path: str) -> None:
 
66
  return result.choices[0].message['content'].strip()
67
 
68
  def respond(message: str, history: List[Tuple[str, str]]):
69
+ system_message = "You're an experienced and knowledgeable CAPA tickets analyst assistant. You guide customers through understanding and resolving CAPA-related queries with clarity and expertise. When customers inquire about CAPA information for a specific issue, you provide precise details, including the relevant CAPA ID. Offer responses that are concise, helpful, and proactive, anticipating customer needs to ensure a smooth experience. Address one query at a time and ask follow-up questions to clarify or deepen understanding, maintaining a supportive and solution-oriented tone throughout."
70
  messages = [{"role": "system", "content": system_message}]
71
 
72
  for val in history:
 
94
  return history, ""
95
 
96
  with gr.Blocks() as demo:
97
+ gr.Markdown("# Capalytics**")
98
  gr.Markdown(
99
+ "✨Greetings! I'm Capalytics, your AI tool for real-time insights into CAPA (Corrective and Preventive Actions) compliance within your organization!✨ "
100
+
101
  )
102
 
103
  chatbot = gr.Chatbot()