Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -48,13 +48,11 @@ def initialize_vector_db():
|
|
48 |
|
49 |
# System instructions for the LLM
|
50 |
system_prompt = """You are an expert Agro-Homeopathy doctor. When providing remedies:
|
51 |
-
1. Always specify potency as 6c unless
|
52 |
2. Request detailed information about:
|
53 |
- Plant symptoms
|
54 |
- Weather conditions
|
55 |
- Temperature
|
56 |
-
- Soil conditions
|
57 |
-
- Duration of the problem
|
58 |
3. Provide comprehensive diagnosis and treatment plans
|
59 |
4. Base recommendations on homeopathic principles
|
60 |
"""
|
@@ -79,9 +77,7 @@ st.markdown("""
|
|
79 |
Please provide complete details about your plant issue including:
|
80 |
- Detailed description of plant symptoms
|
81 |
- Current weather conditions
|
82 |
-
- Temperature
|
83 |
-
- Soil type and conditions
|
84 |
-
- How long the problem has persisted
|
85 |
""")
|
86 |
|
87 |
human_image = "human.png"
|
@@ -125,7 +121,7 @@ print(f"Loading and processing PDFs & vector database took {end_time - start_tim
|
|
125 |
start_time = time.time()
|
126 |
retriever = vector_db.as_retriever()
|
127 |
|
128 |
-
prompt_template = """Use the following pieces of context to answer the question at the end. If the context doesn't provide enough information to answer the question, use your existing knowledge as an Agro-Homeopathy expert to provide the best possible answer.
|
129 |
|
130 |
{context}
|
131 |
|
@@ -146,7 +142,7 @@ qa = RetrievalQA.from_chain_type(
|
|
146 |
)
|
147 |
|
148 |
# Create a separate LLMChain for fallback
|
149 |
-
fallback_template = """You are an expert Agro-Homeopathy doctor. Answer the following question to the best of your ability:
|
150 |
|
151 |
Question: {question}
|
152 |
|
|
|
48 |
|
49 |
# System instructions for the LLM
|
50 |
system_prompt = """You are an expert Agro-Homeopathy doctor. When providing remedies:
|
51 |
+
1. Always specify medicine potency as 6c unless the uploaded text mentions some other value explicitly
|
52 |
2. Request detailed information about:
|
53 |
- Plant symptoms
|
54 |
- Weather conditions
|
55 |
- Temperature
|
|
|
|
|
56 |
3. Provide comprehensive diagnosis and treatment plans
|
57 |
4. Base recommendations on homeopathic principles
|
58 |
"""
|
|
|
77 |
Please provide complete details about your plant issue including:
|
78 |
- Detailed description of plant symptoms
|
79 |
- Current weather conditions
|
80 |
+
- Current Temperature
|
|
|
|
|
81 |
""")
|
82 |
|
83 |
human_image = "human.png"
|
|
|
121 |
start_time = time.time()
|
122 |
retriever = vector_db.as_retriever()
|
123 |
|
124 |
+
prompt_template = """Use the following pieces of context to answer the question at the end. If the context doesn't provide enough information to answer the question, use your existing knowledge as an Agro-Homeopathy expert to provide the best possible answer. But remember to always mention the potency of the medicine. If you don't have that information, then mention the default value as 6c.
|
125 |
|
126 |
{context}
|
127 |
|
|
|
142 |
)
|
143 |
|
144 |
# Create a separate LLMChain for fallback
|
145 |
+
fallback_template = """You are an expert Agro-Homeopathy doctor. Remember to always mention the potency of the suggested medicine. If you don't have that information, then mention the default value as 6c. Answer the following question to the best of your ability:
|
146 |
|
147 |
Question: {question}
|
148 |
|