yasserrmd commited on
Commit
cfea9cd
1 Parent(s): 2a00ab9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -1,10 +1,9 @@
1
  import gradio as gr
2
  import spaces
3
 
4
- # Function to mock the VLLM interpretation and return structured HTML
5
  @spaces.GPU
6
  def diagnose_router(image):
7
- # Structured diagnosis and solution
8
  result = {
9
  "Issue_Description": "Internet connectivity problem - The Internet LED is blinking amber.",
10
  "Root_Cause_Analysis": {
@@ -16,28 +15,28 @@ def diagnose_router(image):
16
  "Error_Code": "WAN PPPoE Timeout",
17
  "Possible_Cause": "This error suggests the router cannot authenticate with the ISP's server, likely due to incorrect login credentials or an ISP-side issue."
18
  },
19
- "Step_by_Step_Troubleshooting": {
20
- "Step_1": {
21
  "Action": "Verify Ethernet Cable Connection",
22
  "Details": "Ensure that the Ethernet cable is securely plugged into the modem's LAN port and the router's WAN port.",
23
  "Expected Outcome": "Ethernet cable is securely connected, and the LED light remains stable."
24
  },
25
- "Step_2": {
26
  "Action": "Restart Both Modem and Router",
27
  "Details": "Unplug both the modem and router from their power sources, wait for 30 seconds, then plug them back in starting with the modem.",
28
  "Expected Outcome": "The router should reattempt to establish a connection with the ISP."
29
  },
30
- "Step_3": {
31
  "Action": "Verify ISP Login Credentials",
32
  "Details": "Access the router settings through its web interface and check the PPPoE login credentials (username and password) provided by your ISP.",
33
  "Expected Outcome": "Correct credentials should resolve the authentication issue."
34
  },
35
- "Step_4": {
36
  "Action": "Contact ISP Support",
37
  "Details": "If the above steps don't work, contact your ISP to check for any issues on their end such as outages or account problems.",
38
  "Expected Outcome": "ISP support will help resolve server authentication issues or provide further guidance."
39
  }
40
- },
41
  "Recommended_Actions": {
42
  "Immediate_Action": "Reconnect cables and restart devices.",
43
  "If_Unresolved": "Check ISP login credentials and contact ISP if needed.",
@@ -65,22 +64,25 @@ def diagnose_router(image):
65
  <ol>
66
  """
67
 
68
- # Loop through each step in the troubleshooting process
69
- for step_key, step_data in result["Step_by_Step_Troubleshooting"].items():
70
  html_output += f"""
71
- <li><strong>{step_data['Action']}</strong>: {step_data['Details']}<br/>
72
- <em>Expected Outcome:</em> {step_data['Expected Outcome']}</li>
73
  """
74
 
 
75
  html_output += f"""
 
 
76
  <h3>Recommended Actions</h3>
77
  <ul>
78
  <li><strong>Immediate Action:</strong> {result['Recommended_Actions']['Immediate_Action']}</li>
79
  <li><strong>If Unresolved:</strong> {result['Recommended_Actions']['If_Unresolved']}</li>
80
  <li><strong>Preventative Measure:</strong> {result['Recommended_Actions']['Preventative_Measure']}</li>
81
  </ul>
 
82
  """
83
-
84
 
85
  return html_output
86
 
 
1
  import gradio as gr
2
  import spaces
3
 
4
+
5
  @spaces.GPU
6
  def diagnose_router(image):
 
7
  result = {
8
  "Issue_Description": "Internet connectivity problem - The Internet LED is blinking amber.",
9
  "Root_Cause_Analysis": {
 
15
  "Error_Code": "WAN PPPoE Timeout",
16
  "Possible_Cause": "This error suggests the router cannot authenticate with the ISP's server, likely due to incorrect login credentials or an ISP-side issue."
17
  },
18
+ "Step_by_Step_Troubleshooting": [
19
+ {
20
  "Action": "Verify Ethernet Cable Connection",
21
  "Details": "Ensure that the Ethernet cable is securely plugged into the modem's LAN port and the router's WAN port.",
22
  "Expected Outcome": "Ethernet cable is securely connected, and the LED light remains stable."
23
  },
24
+ {
25
  "Action": "Restart Both Modem and Router",
26
  "Details": "Unplug both the modem and router from their power sources, wait for 30 seconds, then plug them back in starting with the modem.",
27
  "Expected Outcome": "The router should reattempt to establish a connection with the ISP."
28
  },
29
+ {
30
  "Action": "Verify ISP Login Credentials",
31
  "Details": "Access the router settings through its web interface and check the PPPoE login credentials (username and password) provided by your ISP.",
32
  "Expected Outcome": "Correct credentials should resolve the authentication issue."
33
  },
34
+ {
35
  "Action": "Contact ISP Support",
36
  "Details": "If the above steps don't work, contact your ISP to check for any issues on their end such as outages or account problems.",
37
  "Expected Outcome": "ISP support will help resolve server authentication issues or provide further guidance."
38
  }
39
+ ],
40
  "Recommended_Actions": {
41
  "Immediate_Action": "Reconnect cables and restart devices.",
42
  "If_Unresolved": "Check ISP login credentials and contact ISP if needed.",
 
64
  <ol>
65
  """
66
 
67
+ # Loop through each step in the troubleshooting process (now a list)
68
+ for step in result["Step_by_Step_Troubleshooting"]:
69
  html_output += f"""
70
+ <li><strong>{step['Action']}</strong>: {step['Details']}<br/>
71
+ <em>Expected Outcome:</em> {step['Expected Outcome']}</li>
72
  """
73
 
74
+ # Adding the Recommended Actions section
75
  html_output += f"""
76
+ </ol>
77
+
78
  <h3>Recommended Actions</h3>
79
  <ul>
80
  <li><strong>Immediate Action:</strong> {result['Recommended_Actions']['Immediate_Action']}</li>
81
  <li><strong>If Unresolved:</strong> {result['Recommended_Actions']['If_Unresolved']}</li>
82
  <li><strong>Preventative Measure:</strong> {result['Recommended_Actions']['Preventative_Measure']}</li>
83
  </ul>
84
+ </div>
85
  """
 
86
 
87
  return html_output
88