Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -219,7 +219,7 @@ with st.sidebar:
|
|
219 |
prompt_template = """As an expert organic farming consultant with specialization in Agro-Homeopathy, analyze the following context and question to provide a clear, structured response.
|
220 |
Context: {context}
|
221 |
Previous conversation:{chat_history}
|
222 |
-
Question: {
|
223 |
Provide your response in the following format:
|
224 |
Analysis: Analyze the described plant condition
|
225 |
Treatment: Recommend relevant organic farming principles and specific homeopathic medicine(s) with exact potency and repetition frequency. Suggest a maximum of 4 medicines in the order of relevance for any single problem.
|
@@ -263,7 +263,7 @@ qa = RetrievalQA.from_chain_type(
|
|
263 |
chain_type_kwargs={
|
264 |
"prompt": PromptTemplate(
|
265 |
template=prompt_template,
|
266 |
-
input_variables=["context", "
|
267 |
)
|
268 |
}
|
269 |
)
|
@@ -271,7 +271,7 @@ qa = RetrievalQA.from_chain_type(
|
|
271 |
# Create a separate LLMChain for fallback
|
272 |
fallback_template = """As an expert organic farming consultant with specialization in Agro-Homeopathy, analyze the following context and question to provide a clear, structured response.
|
273 |
Previous conversation:{chat_history}
|
274 |
-
Question: {
|
275 |
Format your response as follows:
|
276 |
Analysis: Analyze the described plant condition
|
277 |
Treatment: Recommend relevant organic farming principles and specific homeopathic medicine(s) with exact potency and repetition frequency. Suggest a maximum of 4 medicines in the order of relevance for any single problem.
|
@@ -346,7 +346,7 @@ if submit_button and query:
|
|
346 |
chat_history = st.session_state.conversation_memory.load_memory_variables({}).get("chat_history", "")
|
347 |
# Generate response
|
348 |
result = qa({
|
349 |
-
"
|
350 |
})
|
351 |
|
352 |
if result['result'].strip() == "":
|
|
|
219 |
prompt_template = """As an expert organic farming consultant with specialization in Agro-Homeopathy, analyze the following context and question to provide a clear, structured response.
|
220 |
Context: {context}
|
221 |
Previous conversation:{chat_history}
|
222 |
+
Question: {query}
|
223 |
Provide your response in the following format:
|
224 |
Analysis: Analyze the described plant condition
|
225 |
Treatment: Recommend relevant organic farming principles and specific homeopathic medicine(s) with exact potency and repetition frequency. Suggest a maximum of 4 medicines in the order of relevance for any single problem.
|
|
|
263 |
chain_type_kwargs={
|
264 |
"prompt": PromptTemplate(
|
265 |
template=prompt_template,
|
266 |
+
input_variables=["context", "query"]
|
267 |
)
|
268 |
}
|
269 |
)
|
|
|
271 |
# Create a separate LLMChain for fallback
|
272 |
fallback_template = """As an expert organic farming consultant with specialization in Agro-Homeopathy, analyze the following context and question to provide a clear, structured response.
|
273 |
Previous conversation:{chat_history}
|
274 |
+
Question: {query}
|
275 |
Format your response as follows:
|
276 |
Analysis: Analyze the described plant condition
|
277 |
Treatment: Recommend relevant organic farming principles and specific homeopathic medicine(s) with exact potency and repetition frequency. Suggest a maximum of 4 medicines in the order of relevance for any single problem.
|
|
|
346 |
chat_history = st.session_state.conversation_memory.load_memory_variables({}).get("chat_history", "")
|
347 |
# Generate response
|
348 |
result = qa({
|
349 |
+
"query": query,
|
350 |
})
|
351 |
|
352 |
if result['result'].strip() == "":
|