Update app.py
Browse files
app.py
CHANGED
@@ -100,6 +100,155 @@ if category_choice == "Flooring":
|
|
100 |
st.warning("⚠️ The confidence score is below 59%. Please manually verify this result.")
|
101 |
else:
|
102 |
compressed_base64 = process_image_for_openai(file_bytes)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
ai_prompt = (
|
104 |
f"Our trained model predicts the following defect: {class_name}. "
|
105 |
|
@@ -115,14 +264,15 @@ if category_choice == "Flooring":
|
|
115 |
model="gpt-4o",
|
116 |
messages=[
|
117 |
{
|
118 |
-
"role": "
|
119 |
-
"content":
|
120 |
-
|
121 |
-
|
122 |
-
|
|
|
123 |
}
|
124 |
],
|
125 |
-
max_tokens=
|
126 |
)
|
127 |
ai_description = response.choices[0].message.content
|
128 |
st.subheader("📝 AI-Generated Defect Description")
|
|
|
100 |
st.warning("⚠️ The confidence score is below 59%. Please manually verify this result.")
|
101 |
else:
|
102 |
compressed_base64 = process_image_for_openai(file_bytes)
|
103 |
+
ai_content = """You are an expert in identifying and resolving defects in wall and flooring systems. Use the provided dataset to analyze and generate all applicable recommended solutions for a given defect or combination of defects.
|
104 |
+
|
105 |
+
The dataset includes three fields:
|
106 |
+
|
107 |
+
Defect
|
108 |
+
|
109 |
+
Sub-Defect Type
|
110 |
+
|
111 |
+
Recommended Solution
|
112 |
+
|
113 |
+
Your task is to do the following:
|
114 |
+
|
115 |
+
Accept a defect name as input (e.g., "Trowel Mark", "Peel off/Debonding").
|
116 |
+
|
117 |
+
Search the dataset and return all matching recommended solutions.
|
118 |
+
|
119 |
+
Clearly label the results by Sub-Defect Type (e.g., Epoxy, PU).
|
120 |
+
|
121 |
+
If a defect includes multiple sub-defect types (e.g., both Epoxy and PU), return all corresponding solutions.
|
122 |
+
|
123 |
+
If the defect is a combined case (e.g., "Cracks on floors Epoxy as well PU"), provide the full solution as a combined recommendation.
|
124 |
+
|
125 |
+
Use the following dataset for reference:
|
126 |
+
|
127 |
+
Dataset:
|
128 |
+
|
129 |
+
vbnet
|
130 |
+
Copy
|
131 |
+
Edit
|
132 |
+
Defect: Spike Roller Mark
|
133 |
+
Sub-Defect Type: Epoxy
|
134 |
+
Recommended Solution:
|
135 |
+
1. Surface preparation on existing resinious flooring by light grinding.
|
136 |
+
2. Application of Primer.
|
137 |
+
3. Application of thin film coating with Apcoflor TC 510
|
138 |
+
|
139 |
+
Defect: Spike Roller Mark
|
140 |
+
Sub-Defect Type: PU
|
141 |
+
Recommended Solution:
|
142 |
+
1. Surface preparation on existing resinious flooring by light grinding.
|
143 |
+
2. Application of Primer.
|
144 |
+
3. Application of thin film coating with Apcoflor PUV
|
145 |
+
|
146 |
+
Defect: Trowel Mark
|
147 |
+
Sub-Defect Type: Epoxy
|
148 |
+
Recommended Solution:
|
149 |
+
1. Surface preparation on existing resinious flooring by light grinding.
|
150 |
+
2. Application of Primer.
|
151 |
+
3. Application of epoxy topcoat with 1mm thickness using Apcoflor SL1TC
|
152 |
+
|
153 |
+
Defect: Trowel Mark
|
154 |
+
Sub-Defect Type: PU
|
155 |
+
Recommended Solution:
|
156 |
+
1. Surface preparation on existing resinious flooring by light grinding
|
157 |
+
2. Groove cutting
|
158 |
+
3. Application of PU scratch coat
|
159 |
+
4. Application of Topcoat with 1 to 2 mm thickness
|
160 |
+
|
161 |
+
Defect: Bubble Formation
|
162 |
+
Sub-Defect Type: Epoxy
|
163 |
+
Recommended Solution:
|
164 |
+
1. Surface preparation on existing resinious flooring by light grinding.
|
165 |
+
2. Application of Primer.
|
166 |
+
3. Application of thin film coating with Apcoflor TC 510
|
167 |
+
|
168 |
+
Defect: Bubble Formation
|
169 |
+
Sub-Defect Type: PU
|
170 |
+
Recommended Solution:
|
171 |
+
1. Surface preparation on existing resinious flooring by light grinding
|
172 |
+
2. Groove cutting
|
173 |
+
3. Application of PU scratch coat
|
174 |
+
4. Application of Topcoat with 1 to 5 mm thickness
|
175 |
+
|
176 |
+
Defect: Peel off/Debonding
|
177 |
+
Sub-Defect Type: Epoxy
|
178 |
+
Recommended Solution:
|
179 |
+
1. Surface preparation on existing resinious flooring by light grinding
|
180 |
+
2. Removing all loose resinious flooring
|
181 |
+
3. Application of Primer
|
182 |
+
4. Application of thin film coating with Apcoflor TC 510/Apcoflor SL1TC
|
183 |
+
|
184 |
+
Defect: Peel off/Debonding
|
185 |
+
Sub-Defect Type: PU
|
186 |
+
Recommended Solution:
|
187 |
+
1. Surface preparation on existing resinious flooring by light grinding
|
188 |
+
2. Groove cutting
|
189 |
+
3. Application of PU scratch coat
|
190 |
+
4. Application of Topcoat with 1 to 5 mm thickness
|
191 |
+
|
192 |
+
Defect: Shade Variation
|
193 |
+
Sub-Defect Type: Epoxy
|
194 |
+
Recommended Solution:
|
195 |
+
1. Surface preparation on existing resinious flooring by light grinding
|
196 |
+
2. Application of Primer
|
197 |
+
3. Application of thin film coating with Apcoflor TC 510/Apcoflor SL1 TC
|
198 |
+
|
199 |
+
Defect: Shade Variation
|
200 |
+
Sub-Defect Type: PU
|
201 |
+
Recommended Solution:
|
202 |
+
1. Surface preparation on existing resinious flooring by light grinding
|
203 |
+
2. Application of Primer
|
204 |
+
3. Application of thin film coating with Apcoflor PUV
|
205 |
+
|
206 |
+
Defect: Cracks on Floors
|
207 |
+
Sub-Defect Type: Epoxy and PU
|
208 |
+
Recommended Solution:
|
209 |
+
1. Surface preparation - opening the cracks in "V" groove
|
210 |
+
2. Application of Primer
|
211 |
+
3. Application of epoxy putty using Apcoflor LSC3 XL
|
212 |
+
|
213 |
+
Defect: Expansion Joint
|
214 |
+
Sub-Defect Type: Cracking & Spalling of Joint Edge
|
215 |
+
Recommended Solution:
|
216 |
+
1. Crack Treatment - Open cracks in "V" groove
|
217 |
+
- Apply Epoxy Primer
|
218 |
+
- Apply epoxy putty using Apcoflor LSC3 XL
|
219 |
+
2. Joint Edge Treatment
|
220 |
+
- Remove loose concrete
|
221 |
+
- Apply Epoxy mortar using Apcoflor HFP 120 + special sand at 1:3.5 mix ratio
|
222 |
+
- Apply at damaged joint edges
|
223 |
+
|
224 |
+
Defect: Expansion Joint
|
225 |
+
Sub-Defect Type: Sealant Failure
|
226 |
+
Recommended Solution:
|
227 |
+
1. Apply PU-based backer rod
|
228 |
+
2. Apply PU/Polysulphide Sealant over the backer rod up to the top of the joint edges
|
229 |
+
3. Provide protection using self-adhesive tapes or aluminum stripping
|
230 |
+
|
231 |
+
Defect: Construction Joint
|
232 |
+
Sub-Defect Type: -
|
233 |
+
Recommended Solution:
|
234 |
+
1. Remove dust/impurities from joints
|
235 |
+
2. Apply Primer
|
236 |
+
3. Apply Epoxy SL Screed or PU Screed
|
237 |
+
|
238 |
+
Defect: Wall & Floor Junction Coving
|
239 |
+
Sub-Defect Type: -
|
240 |
+
Recommended Solution:
|
241 |
+
1. Surface preparation
|
242 |
+
2. Apply Epoxy Primer or scratch coat
|
243 |
+
3. Apply Epoxy mortar using Apcoflor HFP 120 + special graded sand at 1:3 mixing ratio
|
244 |
+
|
245 |
+
Defect: Flooring - POT Holes
|
246 |
+
Sub-Defect Type: -
|
247 |
+
Recommended Solution:
|
248 |
+
1. Surface preparation - Cut the pothole in square/rectangle shape, remove dust/oil
|
249 |
+
2. Apply Epoxy Primer
|
250 |
+
3. Apply Apcoflor HFP 120 + special graded sand at 1:3 mix ratio
|
251 |
+
4. Finish/level the surface """
|
252 |
ai_prompt = (
|
253 |
f"Our trained model predicts the following defect: {class_name}. "
|
254 |
|
|
|
264 |
model="gpt-4o",
|
265 |
messages=[
|
266 |
{
|
267 |
+
"role": "system",
|
268 |
+
"content": ai_content
|
269 |
+
},
|
270 |
+
{
|
271 |
+
"role":"user",
|
272 |
+
"content":"Generate recommended solutions for this defect '{class_name}'"
|
273 |
}
|
274 |
],
|
275 |
+
max_tokens=600,
|
276 |
)
|
277 |
ai_description = response.choices[0].message.content
|
278 |
st.subheader("📝 AI-Generated Defect Description")
|