2001muhammadumair commited on
Commit
61be815
·
verified ·
1 Parent(s): 1967717

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -19
app.py CHANGED
@@ -142,26 +142,50 @@ if uploaded_file is not None:
142
 
143
  # Generate report using Groq (or any other service)
144
  try:
 
145
  chat_completion = client.chat.completions.create(
146
- messages=[
147
- {
148
- "role": "system",
149
- "content": (
150
- "You are a plant disease analysis assistant. Your task is to provide a comprehensive, actionable diagnosis report."
151
- # "The report should include the predicted disease, its symptoms, recommended treatments, and prevention tips. "
152
- "Include the predicted disease, symptoms, treatment recommendations, and prevention tips. "
153
- "Ensure the report is actionable and easy to understand for non-experts in agriculture."
154
- )
155
- },
156
- {
157
- "role": "user",
158
- "content": chat_context
159
- }
160
- ],
161
- model="mixtral-8x7b-32768", # Adjust this to the model you're using
162
- temperature=0.7, # Adjust to balance creativity and precision
163
- max_tokens=1500 # Limit to ensure the output is not cut off
164
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
166
  # Display the generated report in the Streamlit app
167
  st.markdown("---")
 
142
 
143
  # Generate report using Groq (or any other service)
144
  try:
145
+
146
  chat_completion = client.chat.completions.create(
147
+ messages=[
148
+ {
149
+ "role": "system",
150
+ "content": (
151
+ "You are a plant disease analysis assistant. Your task is to provide a comprehensive diagnosis report for plant diseases based on the provided analysis."
152
+ "The report should include:"
153
+ "\n1. **Disease Prediction:** Name of the disease."
154
+ "\n2. **Symptoms:** Describe the common symptoms observed in plants affected by this disease."
155
+ "\n3. **Treatment Options:** Recommended treatments, including chemical and organic methods."
156
+ "\n4. **Prevention Tips:** Guidelines on how to prevent this disease in the future."
157
+ "\n\nEnsure that the report is actionable, concise, and easy to understand for someone who may not be an expert in agriculture."
158
+ )
159
+ },
160
+ {
161
+ "role": "user",
162
+ "content": chat_context # Ensure chat_context contains relevant information like image analysis, plant name, etc.
163
+ }
164
+ ],
165
+ model="mixtral-8x7b-32768", # Confirm this model ID with your setup
166
+ temperature=0.5, # Lower temperature for factual information
167
+ max_tokens=1500 # Set tokens to limit output as per need
168
+ )
169
+ # chat_completion = client.chat.completions.create(
170
+ # messages=[
171
+ # {
172
+ # "role": "system",
173
+ # "content": (
174
+ # "You are a plant disease analysis assistant. Your task is to provide a comprehensive, actionable diagnosis report."
175
+ # "The report should include the predicted disease, its symptoms, recommended treatments, and prevention tips. "
176
+
177
+ # "Ensure the report is actionable and easy to understand for non-experts in agriculture."
178
+ # )
179
+ # },
180
+ # {
181
+ # "role": "user",
182
+ # "content": chat_context
183
+ # }
184
+ # ],
185
+ # model="mixtral-8x7b-32768", # Adjust this to the model you're using
186
+ # temperature=0.7, # Adjust to balance creativity and precision
187
+ # max_tokens=1500 # Limit to ensure the output is not cut off
188
+ # )
189
 
190
  # Display the generated report in the Streamlit app
191
  st.markdown("---")