Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -294,13 +294,13 @@ def get_multiple_recommendations(pred_caption: str, llm_model, tokenizer_model,
|
|
| 294 |
f'CAPTION: "{pred_caption}"\n\n'
|
| 295 |
f"{context_text}"
|
| 296 |
"INSTRUCTION: Generate a comprehensive analysis and recommendation in the following three-part stacked format, with rich descriptive text:\n"
|
| 297 |
-
"1.
|
| 298 |
-
"2.
|
| 299 |
-
"3.
|
| 300 |
"Ensure the output strictly follows the 'Label: Text' format below. Do not add extra text, line breaks, or numbering.\n\n"
|
| 301 |
-
"
|
| 302 |
-
"
|
| 303 |
-
"
|
| 304 |
)
|
| 305 |
|
| 306 |
messages = [
|
|
@@ -406,9 +406,9 @@ def process_image_upload(image: Image.Image):
|
|
| 406 |
caption = generate_caption_beam(caption_model, img_tensor, device)
|
| 407 |
except Exception as e:
|
| 408 |
print("Caption generation error:", e)
|
| 409 |
-
caption = "
|
| 410 |
else:
|
| 411 |
-
caption = "
|
| 412 |
|
| 413 |
recommendations, retrieved_list = get_multiple_recommendations(caption, llm, llm_tokenizer, KNOWLEDGE_BASE)
|
| 414 |
|
|
|
|
| 294 |
f'CAPTION: "{pred_caption}"\n\n'
|
| 295 |
f"{context_text}"
|
| 296 |
"INSTRUCTION: Generate a comprehensive analysis and recommendation in the following three-part stacked format, with rich descriptive text:\n"
|
| 297 |
+
"1. Cause: A detailed sentence describing the likely cause and condition based on the caption and RAG context.\n"
|
| 298 |
+
"2. Immediate Action: A comprehensive sentence detailing specific, time-sensitive actions the grower must take immediately.\n"
|
| 299 |
+
"3. Long-term Action: A forward-looking sentence outlining preventative and sustainable strategies for the future.\n"
|
| 300 |
"Ensure the output strictly follows the 'Label: Text' format below. Do not add extra text, line breaks, or numbering.\n\n"
|
| 301 |
+
"Cause: [Your descriptive text for the cause]\n"
|
| 302 |
+
"Immediate Action: [Your descriptive text for the immediate steps]\n"
|
| 303 |
+
"Long-term Action: [Your descriptive text for the long-term steps]\n"
|
| 304 |
)
|
| 305 |
|
| 306 |
messages = [
|
|
|
|
| 406 |
caption = generate_caption_beam(caption_model, img_tensor, device)
|
| 407 |
except Exception as e:
|
| 408 |
print("Caption generation error:", e)
|
| 409 |
+
caption = "Wrong Plant/Fruit Image!"
|
| 410 |
else:
|
| 411 |
+
caption = "Wrong Plant/Fruit Image!"
|
| 412 |
|
| 413 |
recommendations, retrieved_list = get_multiple_recommendations(caption, llm, llm_tokenizer, KNOWLEDGE_BASE)
|
| 414 |
|