Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,6 @@ from groq import Groq
|
|
8 |
from reportlab.lib.pagesizes import letter
|
9 |
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
|
10 |
from reportlab.lib.styles import getSampleStyleSheet
|
11 |
-
import pandas as pd
|
12 |
|
13 |
# ======================
|
14 |
# CONFIGURATION SETTINGS
|
@@ -102,7 +101,18 @@ def generate_rice_report(uploaded_file, client):
|
|
102 |
messages=[
|
103 |
{"role": "user", "content": [
|
104 |
{"type": "text", "text": (
|
105 |
-
"Analyze the rice grain image and provide a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
)},
|
107 |
{"type": "image_url", "image_url": {"url": image_url}},
|
108 |
]}
|
@@ -135,11 +145,11 @@ def display_main_interface():
|
|
135 |
|
136 |
if 'analysis_result' in st.session_state:
|
137 |
st.markdown("### π Analysis Report")
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
pdf_report = generate_pdf_report(
|
143 |
st.download_button(
|
144 |
label="π Download PDF Report",
|
145 |
data=pdf_report,
|
@@ -155,6 +165,6 @@ def main():
|
|
155 |
"""Primary application controller."""
|
156 |
groq_client = initialize_api_client()
|
157 |
display_main_interface()
|
158 |
-
|
159 |
if __name__ == "__main__":
|
160 |
main()
|
|
|
8 |
from reportlab.lib.pagesizes import letter
|
9 |
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
|
10 |
from reportlab.lib.styles import getSampleStyleSheet
|
|
|
11 |
|
12 |
# ======================
|
13 |
# CONFIGURATION SETTINGS
|
|
|
101 |
messages=[
|
102 |
{"role": "user", "content": [
|
103 |
{"type": "text", "text": (
|
104 |
+
"Analyze the rice grain image and provide a detailed report including:\n"
|
105 |
+
"1. Rice type classification\n2. Quality assessment (broken grains %, discoloration %, impurities %)\n"
|
106 |
+
"3. Foreign object detection\n4. Size and shape consistency\n5. Recommendations for processing or improvement\n"
|
107 |
+
"6. Additional metrics:\n"
|
108 |
+
" - % Broken kernel (Accuracy < 0.5%)\n"
|
109 |
+
" - Size analysis per each kernel (Accuracy < 50 micron):\n"
|
110 |
+
" - Length, Width, Area, Length to Width Ratio\n"
|
111 |
+
" - Abnormal color and damage kernel recognition:\n"
|
112 |
+
" - Chalky, Black spots, Yellow (Heat damage), Red (Heat damage), Green kernels\n"
|
113 |
+
" - Kernel count\n"
|
114 |
+
" - 1,000 kernels weight\n"
|
115 |
+
" - Group sizing information"
|
116 |
)},
|
117 |
{"type": "image_url", "image_url": {"url": image_url}},
|
118 |
]}
|
|
|
145 |
|
146 |
if 'analysis_result' in st.session_state:
|
147 |
st.markdown("### π Analysis Report")
|
148 |
+
st.markdown(
|
149 |
+
f'<div class="report-container"><div class="report-text">{st.session_state.analysis_result}</div></div>',
|
150 |
+
unsafe_allow_html=True
|
151 |
+
)
|
152 |
+
pdf_report = generate_pdf_report(st.session_state.analysis_result)
|
153 |
st.download_button(
|
154 |
label="π Download PDF Report",
|
155 |
data=pdf_report,
|
|
|
165 |
"""Primary application controller."""
|
166 |
groq_client = initialize_api_client()
|
167 |
display_main_interface()
|
168 |
+
|
169 |
if __name__ == "__main__":
|
170 |
main()
|