Update app.py
Browse files
app.py
CHANGED
|
@@ -193,10 +193,6 @@ def extract_json_from_markdown(markdown_text):
|
|
| 193 |
|
| 194 |
@spaces.GPU
|
| 195 |
def diagnose_router(image):
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
messages = [
|
| 201 |
{"role": "user", "content": [
|
| 202 |
{"type": "image"},
|
|
@@ -218,44 +214,44 @@ def diagnose_router(image):
|
|
| 218 |
#print (result)
|
| 219 |
|
| 220 |
# Generate HTML content for structured display
|
| 221 |
-
html_output = f"""
|
| 222 |
-
<div style="font-family: Arial, sans-serif; color: #333;">
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
"""
|
| 239 |
|
| 240 |
-
# Loop through each step in the troubleshooting process (now a list)
|
| 241 |
-
for step in result["Step_by_Step_Troubleshooting"]:
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
|
| 247 |
-
# Adding the Recommended Actions section
|
| 248 |
-
html_output += f"""
|
| 249 |
-
|
| 250 |
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
</div>
|
| 258 |
-
"""
|
| 259 |
html_output = markdown.markdown(markdown_text)
|
| 260 |
return html_output
|
| 261 |
|
|
|
|
| 193 |
|
| 194 |
@spaces.GPU
|
| 195 |
def diagnose_router(image):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
messages = [
|
| 197 |
{"role": "user", "content": [
|
| 198 |
{"type": "image"},
|
|
|
|
| 214 |
#print (result)
|
| 215 |
|
| 216 |
# Generate HTML content for structured display
|
| 217 |
+
# html_output = f"""
|
| 218 |
+
# <div style="font-family: Arial, sans-serif; color: #333;">
|
| 219 |
+
# <h2>Router Diagnosis</h2>
|
| 220 |
+
# <h3>Issue Description</h3>
|
| 221 |
+
# <p><strong>{result['Issue_Description']}</strong></p>
|
| 222 |
|
| 223 |
+
# <h3>Root Cause Analysis</h3>
|
| 224 |
+
# <ul>
|
| 225 |
+
# <li><strong>LED Color:</strong> {result['Root_Cause_Analysis']['LED_Analysis']['Color']}</li>
|
| 226 |
+
# <li><strong>LED Pattern:</strong> {result['Root_Cause_Analysis']['LED_Analysis']['Pattern']}</li>
|
| 227 |
+
# <li><strong>Indicates:</strong> {result['Root_Cause_Analysis']['LED_Analysis']['Indicates']}</li>
|
| 228 |
+
# <li><strong>Error Code:</strong> {result['Root_Cause_Analysis']['Error_Code']}</li>
|
| 229 |
+
# <li><strong>Possible Cause:</strong> {result['Root_Cause_Analysis']['Possible_Cause']}</li>
|
| 230 |
+
# </ul>
|
| 231 |
|
| 232 |
+
# <h3>Step-by-Step Troubleshooting</h3>
|
| 233 |
+
# <ol>
|
| 234 |
+
# """
|
| 235 |
|
| 236 |
+
# # Loop through each step in the troubleshooting process (now a list)
|
| 237 |
+
# for step in result["Step_by_Step_Troubleshooting"]:
|
| 238 |
+
# html_output += f"""
|
| 239 |
+
# <li><strong>{step['Action']}</strong>: {step['Details']}<br/>
|
| 240 |
+
# <em>Expected Outcome:</em> {step['Expected Outcome']}</li>
|
| 241 |
+
# """
|
| 242 |
|
| 243 |
+
# # Adding the Recommended Actions section
|
| 244 |
+
# html_output += f"""
|
| 245 |
+
# </ol>
|
| 246 |
|
| 247 |
+
# <h3>Recommended Actions</h3>
|
| 248 |
+
# <ul>
|
| 249 |
+
# <li><strong>Immediate Action:</strong> {result['Recommended_Actions']['Immediate_Action']}</li>
|
| 250 |
+
# <li><strong>If Unresolved:</strong> {result['Recommended_Actions']['If_Unresolved']}</li>
|
| 251 |
+
# <li><strong>Preventative Measure:</strong> {result['Recommended_Actions']['Preventative_Measure']}</li>
|
| 252 |
+
# </ul>
|
| 253 |
+
# </div>
|
| 254 |
+
# """
|
| 255 |
html_output = markdown.markdown(markdown_text)
|
| 256 |
return html_output
|
| 257 |
|