Spaces:
Build error
Build error
Update app.py
Browse files
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
|
| 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("
|
| 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
|
| 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("#
|
| 98 |
gr.Markdown(
|
| 99 |
-
"
|
| 100 |
-
|
| 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()
|