Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -142,50 +142,26 @@ if uploaded_file is not None:
|
|
142 |
|
143 |
# Generate report using Groq (or any other service)
|
144 |
try:
|
145 |
-
|
146 |
chat_completion = client.chat.completions.create(
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
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 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
|
190 |
# Display the generated report in the Streamlit app
|
191 |
st.markdown("---")
|
|
|
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 |
|
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=5000 # Limit to ensure the output is not cut off
|
164 |
+
)
|
165 |
|
166 |
# Display the generated report in the Streamlit app
|
167 |
st.markdown("---")
|