Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,7 @@ class MyApp:
|
|
| 14 |
self.documents = []
|
| 15 |
self.embeddings = None
|
| 16 |
self.index = None
|
| 17 |
-
self.load_pdf("
|
| 18 |
self.build_vector_db()
|
| 19 |
|
| 20 |
def load_pdf(self, file_path: str) -> None:
|
|
@@ -53,7 +53,7 @@ def respond(
|
|
| 53 |
temperature: float,
|
| 54 |
top_p: float,
|
| 55 |
):
|
| 56 |
-
system_message = "You are a knowledgeable
|
| 57 |
messages = [{"role": "system", "content": system_message}]
|
| 58 |
|
| 59 |
for val in history:
|
|
@@ -85,22 +85,22 @@ demo = gr.Blocks()
|
|
| 85 |
|
| 86 |
with demo:
|
| 87 |
gr.Markdown(
|
| 88 |
-
"‼️Disclaimer: This chatbot is based on a
|
| 89 |
)
|
| 90 |
|
| 91 |
chatbot = gr.ChatInterface(
|
| 92 |
respond,
|
| 93 |
examples=[
|
| 94 |
-
["I
|
| 95 |
-
["Can you
|
| 96 |
-
["
|
| 97 |
-
["
|
| 98 |
-
["
|
| 99 |
-
["
|
| 100 |
-
["
|
| 101 |
-
["
|
| 102 |
],
|
| 103 |
-
title='
|
| 104 |
)
|
| 105 |
|
| 106 |
if __name__ == "__main__":
|
|
|
|
| 14 |
self.documents = []
|
| 15 |
self.embeddings = None
|
| 16 |
self.index = None
|
| 17 |
+
self.load_pdf("ENGINEERING.pdf")
|
| 18 |
self.build_vector_db()
|
| 19 |
|
| 20 |
def load_pdf(self, file_path: str) -> None:
|
|
|
|
| 53 |
temperature: float,
|
| 54 |
top_p: float,
|
| 55 |
):
|
| 56 |
+
system_message = "You are a knowledgeable and skilled electrical engineer. You provide clear, concise, and helpful information about electrical systems, circuits, and devices. You answer one question at a time, ensuring that your responses are easy to understand and informative. Remember to be respectful, patient, and thorough, considering that users may have varying levels of technical knowledge. You guide users through troubleshooting electrical issues, offer advice on electrical design and safety, and provide recommendations for common electrical problems. If a user mentions a potentially dangerous electrical situation, you advise them to turn off the power immediately and contact a professional electrician. Your goal is to help users understand and solve their electrical issues while promoting safety and best practices."
|
| 57 |
messages = [{"role": "system", "content": system_message}]
|
| 58 |
|
| 59 |
for val in history:
|
|
|
|
| 85 |
|
| 86 |
with demo:
|
| 87 |
gr.Markdown(
|
| 88 |
+
"‼️Disclaimer: This chatbot is based on a numerical modelling and design of machines book that is publicly available. and just to test RAG implementation.‼️"
|
| 89 |
)
|
| 90 |
|
| 91 |
chatbot = gr.ChatInterface(
|
| 92 |
respond,
|
| 93 |
examples=[
|
| 94 |
+
["How do I troubleshoot a circuit breaker that keeps tripping?"],
|
| 95 |
+
["Can you explain how to design a basic electrical circuit?"],
|
| 96 |
+
["What safety precautions should I take when working with electrical wiring?"],
|
| 97 |
+
["How can I calculate the voltage drop in a long electrical cable?"],
|
| 98 |
+
["Could you recommend energy-saving tips for home appliances?"],
|
| 99 |
+
["How does surge protection work, and why is it important?"],
|
| 100 |
+
["What are the current standards for electrical wiring in new construction?"],
|
| 101 |
+
["What are the key components of a residential electrical panel?"]
|
| 102 |
],
|
| 103 |
+
title='Electrical Engineer'
|
| 104 |
)
|
| 105 |
|
| 106 |
if __name__ == "__main__":
|