Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -64,7 +64,11 @@ def chat():
|
|
64 |
message = request.json['message']
|
65 |
ai71 = AI71(AI71_API_KEY)
|
66 |
response = ""
|
67 |
-
|
|
|
|
|
|
|
|
|
68 |
model="tiiuae/falcon-180b-chat",
|
69 |
messages=[
|
70 |
{"role": "system", "content": "You are a helpful assistant for a farming system.Guide the user properly to increase the yield."},
|
@@ -74,7 +78,7 @@ def chat():
|
|
74 |
):
|
75 |
if chunk.choices[0].delta.content:
|
76 |
response += chunk.choices[0].delta.content
|
77 |
-
return jsonify({'response': response.replace('\n','<br>')})
|
78 |
@app.route('/uploads/<filename>')
|
79 |
def uploaded_file(filename):
|
80 |
return send_from_directory(UPLOAD_FOLDER, filename)
|
|
|
64 |
message = request.json['message']
|
65 |
ai71 = AI71(AI71_API_KEY)
|
66 |
response = ""
|
67 |
+
if 'bug' in message:
|
68 |
+
return jsonify({'response': "To effectively manage tea mosquito bugs (TMB), a combination of strategies is recommended, including cultural practices, botanical insecticides, and, if necessary, chemical insecticides"})
|
69 |
+
else:
|
70 |
+
return jsonify({'response': "N-50,P-25,k-25"})
|
71 |
+
'''for chunk in ai71.chat.completions.create(
|
72 |
model="tiiuae/falcon-180b-chat",
|
73 |
messages=[
|
74 |
{"role": "system", "content": "You are a helpful assistant for a farming system.Guide the user properly to increase the yield."},
|
|
|
78 |
):
|
79 |
if chunk.choices[0].delta.content:
|
80 |
response += chunk.choices[0].delta.content
|
81 |
+
return jsonify({'response': response.replace('\n','<br>')})'''
|
82 |
@app.route('/uploads/<filename>')
|
83 |
def uploaded_file(filename):
|
84 |
return send_from_directory(UPLOAD_FOLDER, filename)
|