yasserrmd commited on
Commit
58cf684
1 Parent(s): f2a9633

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -37
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
- <h2>Router Diagnosis</h2>
224
- <h3>Issue Description</h3>
225
- <p><strong>{result['Issue_Description']}</strong></p>
226
 
227
- <h3>Root Cause Analysis</h3>
228
- <ul>
229
- <li><strong>LED Color:</strong> {result['Root_Cause_Analysis']['LED_Analysis']['Color']}</li>
230
- <li><strong>LED Pattern:</strong> {result['Root_Cause_Analysis']['LED_Analysis']['Pattern']}</li>
231
- <li><strong>Indicates:</strong> {result['Root_Cause_Analysis']['LED_Analysis']['Indicates']}</li>
232
- <li><strong>Error Code:</strong> {result['Root_Cause_Analysis']['Error_Code']}</li>
233
- <li><strong>Possible Cause:</strong> {result['Root_Cause_Analysis']['Possible_Cause']}</li>
234
- </ul>
235
 
236
- <h3>Step-by-Step Troubleshooting</h3>
237
- <ol>
238
- """
239
 
240
- # Loop through each step in the troubleshooting process (now a list)
241
- for step in result["Step_by_Step_Troubleshooting"]:
242
- html_output += f"""
243
- <li><strong>{step['Action']}</strong>: {step['Details']}<br/>
244
- <em>Expected Outcome:</em> {step['Expected Outcome']}</li>
245
- """
246
 
247
- # Adding the Recommended Actions section
248
- html_output += f"""
249
- </ol>
250
 
251
- <h3>Recommended Actions</h3>
252
- <ul>
253
- <li><strong>Immediate Action:</strong> {result['Recommended_Actions']['Immediate_Action']}</li>
254
- <li><strong>If Unresolved:</strong> {result['Recommended_Actions']['If_Unresolved']}</li>
255
- <li><strong>Preventative Measure:</strong> {result['Recommended_Actions']['Preventative_Measure']}</li>
256
- </ul>
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