Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -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:
|
|
@@ -65,9 +65,8 @@ def shorten_response(response: str) -> str:
|
|
| 65 |
result = client.chat_completion(messages, max_tokens=512, temperature=0.2, top_p=0.9)
|
| 66 |
return result.choices[0].message['content'].strip()
|
| 67 |
|
| 68 |
-
#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. Address one query at a time and ask follow-up questions to clarify or deepen understanding, maintaining a supportive and solution-oriented tone throughout. Remember to give CAPA Name, CAPA count, Capa Title and problem summary for each query.
|
| 69 |
def respond(message: str, history: List[Tuple[str, str]]):
|
| 70 |
-
system_message = """
|
| 71 |
messages = [{"role": "system", "content": system_message}]
|
| 72 |
|
| 73 |
for val in history:
|
|
@@ -95,9 +94,9 @@ def respond(message: str, history: List[Tuple[str, str]]):
|
|
| 95 |
return history, ""
|
| 96 |
|
| 97 |
with gr.Blocks() as demo:
|
| 98 |
-
gr.Markdown("#
|
| 99 |
gr.Markdown(
|
| 100 |
-
"✨Greetings! I'm
|
| 101 |
|
| 102 |
)
|
| 103 |
|
|
|
|
| 15 |
self.documents = []
|
| 16 |
self.embeddings = None
|
| 17 |
self.index = None
|
| 18 |
+
self.load_pdf("Abhijith N_Resume.pdf")
|
| 19 |
self.build_vector_db()
|
| 20 |
|
| 21 |
def load_pdf(self, file_path: str) -> None:
|
|
|
|
| 65 |
result = client.chat_completion(messages, max_tokens=512, temperature=0.2, top_p=0.9)
|
| 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 Q&A assistant named Vasuki. If anyone asks your name, remember to say your name is Vasuki. Please provide a detailed and thorough response to the following query. Ensure that the answer is clear, concise, and includes examples where appropriate. For all other inquiries, your main goal is to provide answers as accurately as possible, based on the instructions and context you have been given. If a question does not match the provided context or is outside the scope of the document, kindly advise the user to ask questions within the context of the document. If the user asks for a summary of the attached document, provide a detailed summary of the uploaded document."""
|
| 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("# Vasuki")
|
| 98 |
gr.Markdown(
|
| 99 |
+
"✨Greetings! I'm Vasuki, your AI tool for communicating with your pdf files✨ "
|
| 100 |
|
| 101 |
)
|
| 102 |
|