Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -100,35 +100,28 @@ 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_content = """
|
|
|
|
| 104 |
|
| 105 |
-
|
|
|
|
| 106 |
|
| 107 |
-
Defect
|
| 108 |
|
| 109 |
-
|
| 110 |
|
| 111 |
-
|
| 112 |
|
| 113 |
-
|
| 114 |
|
| 115 |
-
|
| 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 |
-
|
| 130 |
-
Copy
|
| 131 |
-
Edit
|
| 132 |
Defect: Spike Roller Mark
|
| 133 |
Sub-Defect Type: Epoxy
|
| 134 |
Recommended Solution:
|
|
@@ -248,7 +241,54 @@ 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 |
|
|
|
|
| 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 = """
|
| 104 |
+
You are an expert in identifying and resolving wall and flooring defects. Use the dataset below to generate all applicable recommended solutions for any provided defect or combination of defects.
|
| 105 |
|
| 106 |
+
Instructions:
|
| 107 |
+
Accept a defect name as input.
|
| 108 |
|
| 109 |
+
Search the dataset for matches and return all recommended solutions, grouped by Sub-Defect Type.
|
| 110 |
|
| 111 |
+
If the defect appears under multiple subtypes, combine and list all applicable solutions.
|
| 112 |
|
| 113 |
+
If the defect is not found in the dataset, use semantic analysis and your domain expertise to generate a logical and professional solution.
|
| 114 |
|
| 115 |
+
Do not mention whether the defect is listed in the dataset or not — simply return the recommended solution.
|
| 116 |
|
| 117 |
+
Use clear steps such as: surface preparation, grinding, priming, coating, sealing, repairing, joint treatment, or finishing, depending on the nature of the defect
|
| 118 |
|
|
|
|
| 119 |
|
|
|
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
|
| 122 |
Dataset:
|
| 123 |
|
| 124 |
+
|
|
|
|
|
|
|
| 125 |
Defect: Spike Roller Mark
|
| 126 |
Sub-Defect Type: Epoxy
|
| 127 |
Recommended Solution:
|
|
|
|
| 241 |
1. Surface preparation - Cut the pothole in square/rectangle shape, remove dust/oil
|
| 242 |
2. Apply Epoxy Primer
|
| 243 |
3. Apply Apcoflor HFP 120 + special graded sand at 1:3 mix ratio
|
| 244 |
+
4. Finish/level the surface
|
| 245 |
+
|
| 246 |
+
Fallback Logic for Unknown Defects:
|
| 247 |
+
Use these patterns to infer the solution without stating the defect is not listed.
|
| 248 |
+
|
| 249 |
+
Structural Defect:
|
| 250 |
+
|
| 251 |
+
Cut/clean damaged area
|
| 252 |
+
|
| 253 |
+
Surface preparation (light grinding or cutting)
|
| 254 |
+
|
| 255 |
+
Apply epoxy/PU primer
|
| 256 |
+
|
| 257 |
+
Apply screed or mortar (e.g., Apcoflor HFP 120 + sand)
|
| 258 |
+
|
| 259 |
+
Finish and level as needed
|
| 260 |
+
|
| 261 |
+
Aesthetic Defect (e.g., fading, discoloration):
|
| 262 |
+
|
| 263 |
+
Surface preparation by light grinding
|
| 264 |
+
|
| 265 |
+
Application of appropriate primer
|
| 266 |
+
|
| 267 |
+
Application of thin film coating (Epoxy: Apcoflor TC 510, PU: Apcoflor PUV, Hybrid as needed)
|
| 268 |
+
|
| 269 |
+
Final finish for uniform appearance
|
| 270 |
+
|
| 271 |
+
Cracks & Breaks:
|
| 272 |
+
|
| 273 |
+
Open in "V" groove
|
| 274 |
+
|
| 275 |
+
Apply primer
|
| 276 |
+
|
| 277 |
+
Fill with epoxy putty (e.g., Apcoflor LSC3 XL)
|
| 278 |
+
|
| 279 |
+
Joint Issues:
|
| 280 |
+
|
| 281 |
+
Remove loose particles
|
| 282 |
+
|
| 283 |
+
Apply epoxy primer
|
| 284 |
+
|
| 285 |
+
Joint treatment with sealants or epoxy mortars
|
| 286 |
+
|
| 287 |
+
Protect with tape or metal strip if needed
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
"""
|
| 291 |
+
|
| 292 |
ai_prompt = (
|
| 293 |
f"Our trained model predicts the following defect: {class_name}. "
|
| 294 |
|