workbykait commited on
Commit
1b9a115
·
verified ·
1 Parent(s): 68b31b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -59,7 +59,7 @@ def analyze_log(log_text):
59
  try:
60
  response = requests.post(url, json=data, headers=headers)
61
  summary = response.json()["choices"][0]["message"]["content"]
62
- html = "<div style='font-family:Roboto; color:white; background:#333; padding:10px; border-radius:5px;'><h3>Analysis</h3><ul>"
63
  for line in summary.split("\n"):
64
  if "Issues:" in line:
65
  html += "<li><b style='color:#ff6200;'>Issues:</b><ul>"
@@ -70,7 +70,6 @@ def analyze_log(log_text):
70
  elif line.strip():
71
  html += f"<li>{line.strip()}</li>"
72
  html += "</ul></div>"
73
- # Robust signal extraction
74
  signals = []
75
  times = []
76
  for line in log_text.split("\n"):
@@ -103,7 +102,7 @@ def generate_alert(log_text):
103
  try:
104
  response = requests.post(url, json=data, headers=headers)
105
  alert = response.json()["choices"][0]["message"]["content"]
106
- return f"<div style='font-family:Roboto; background:#ff6200; color:black; padding:10px; border-radius:5px;'>{alert}</div>"
107
  except Exception as e:
108
  return f"Error: Alert failed - {str(e)}"
109
 
@@ -125,7 +124,7 @@ def compare_logs():
125
  try:
126
  response = requests.post(url, json=data, headers=headers)
127
  comparison = response.json()["choices"][0]["message"]["content"]
128
- html = "<div style='font-family:Roboto; color:white; background:#333; padding:10px; border-radius:5px;'><h3>Comparison</h3><ul>"
129
  for line in comparison.split("\n"):
130
  if line.strip():
131
  html += f"<li>{line.strip()}</li>"
@@ -141,11 +140,12 @@ def clear_log():
141
  return ""
142
 
143
  css = """
144
- body, .gradio-container { background: black; color: white; font-family: Roboto, sans-serif; }
145
- button { background: #ff6200; color: black; border: none; padding: 8px 16px; border-radius: 5px; }
146
  button:hover { background: #e55a00; }
147
- .input-text, .output-text { background: #333; color: white; border: 1px solid #ff6200; border-radius: 5px; }
148
  h3 { color: #ff6200; }
 
149
  """
150
  with gr.Blocks(css=css) as interface:
151
  gr.Markdown("# Satellite Signal Log Analyzer", elem_classes="header")
 
59
  try:
60
  response = requests.post(url, json=data, headers=headers)
61
  summary = response.json()["choices"][0]["message"]["content"]
62
+ html = "<div style='font-family:Roboto; color:black; background:white; padding:10px; border-radius:5px; border:1px solid #ff6200;'><h3>Analysis</h3><ul>"
63
  for line in summary.split("\n"):
64
  if "Issues:" in line:
65
  html += "<li><b style='color:#ff6200;'>Issues:</b><ul>"
 
70
  elif line.strip():
71
  html += f"<li>{line.strip()}</li>"
72
  html += "</ul></div>"
 
73
  signals = []
74
  times = []
75
  for line in log_text.split("\n"):
 
102
  try:
103
  response = requests.post(url, json=data, headers=headers)
104
  alert = response.json()["choices"][0]["message"]["content"]
105
+ return f"<div style='font-family:Roboto; background:#ff6200; color:white; padding:10px; border-radius:5px;'>{alert}</div>"
106
  except Exception as e:
107
  return f"Error: Alert failed - {str(e)}"
108
 
 
124
  try:
125
  response = requests.post(url, json=data, headers=headers)
126
  comparison = response.json()["choices"][0]["message"]["content"]
127
+ html = "<div style='font-family:Roboto; color:black; background:white; padding:10px; border-radius:5px; border:1px solid #ff6200;'><h3>Comparison</h3><ul>"
128
  for line in comparison.split("\n"):
129
  if line.strip():
130
  html += f"<li>{line.strip()}</li>"
 
140
  return ""
141
 
142
  css = """
143
+ body, .gradio-container { background: white; color: black; font-family: Roboto, sans-serif; }
144
+ button { background: #ff6200; color: white; border: none; padding: 8px 16px; border-radius: 5px; }
145
  button:hover { background: #e55a00; }
146
+ .input-text, .output-text { background: white; color: black; border: 1px solid #ff6200; border-radius: 5px; }
147
  h3 { color: #ff6200; }
148
+ .header, .subheader { color: #ff6200; text-align: center; }
149
  """
150
  with gr.Blocks(css=css) as interface:
151
  gr.Markdown("# Satellite Signal Log Analyzer", elem_classes="header")