Spaces:
Running
Running
Create chat_engine.py
Browse files- mock_models/chat_engine.py +14 -0
mock_models/chat_engine.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class AgriculturalChatEngine:
|
2 |
+
def __init__(self):
|
3 |
+
self.responses = {
|
4 |
+
'fertilizer': "Organic compost is recommended for most crops in your area.",
|
5 |
+
'pest': "Neem oil spray is effective against common pests while being eco-friendly.",
|
6 |
+
'default': "For optimal results, maintain proper irrigation and soil pH levels."
|
7 |
+
}
|
8 |
+
|
9 |
+
def generate_response(self, query):
|
10 |
+
query = query.lower()
|
11 |
+
for key in self.responses:
|
12 |
+
if key in query:
|
13 |
+
return f"🌱 Agricultural Assistant: {self.responses[key]}"
|
14 |
+
return f"🌱 Agricultural Assistant: {self.responses['default']}"
|