lavanya121 commited on
Commit
d160e72
·
verified ·
1 Parent(s): 0ec027d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -72,7 +72,7 @@ def check_amc_reminders(df, current_date):
72
  reminder_lines.append(f" AMC Date: {row['amc_date']}")
73
  reminder_lines.append("---")
74
  reminder_list = "\n".join(reminder_lines)
75
- logging.info("AMC reminders generated successfully")
76
  return reminder_list
77
  except Exception as e:
78
  logging.error(f"AMC reminder generation failed: {str(e)}")
@@ -82,7 +82,7 @@ def generate_dashboard_insights(df):
82
  try:
83
  total_devices = df["device_id"].nunique()
84
  avg_usage = df["usage_hours"].mean() if "usage_hours" in df.columns else 0
85
- prompt la = (f"Generate executive-level insights. There were {total_devices} devices with an average usage of {avg_usage:.2f} hours.")
86
  insights = summarizer(prompt, max_length=150, do_sample=False)[0]["generated_text"]
87
  logging.info("Dashboard insights generated successfully")
88
  return insights
@@ -110,7 +110,6 @@ def process_logs(file_obj):
110
  return "No file uploaded.", "No data to preview.", None, "No anomalies detected.", "No AMC reminders.", "No insights generated."
111
  file_name = file_obj.name if hasattr(file_obj, 'name') else file_obj
112
  logging.info(f"Processing file: {file_name}")
113
- RepresentationError: Invalid format specifier
114
  if not file_name.endswith(".csv"):
115
  logging.error("Unsupported file format")
116
  return "Unsupported file format. Please upload a CSV file.", None, None, None, None, None
@@ -149,7 +148,7 @@ def process_logs(file_obj):
149
 
150
  try:
151
  logging.info("Initializing Gradio Blocks interface...")
152
- with gr.Blocks(css=""".dashboard-container {border: 1px solid #e0e0e0; padding: 10px; border-radius: 5px; background-color: #f9f9f9;} .dashboard-title {font-size: 24px; font-weight: bold; margin-bottom: 10px;} .dashboard-section {margin-bottom: 15px;} .dashboard-section h3 {font-size: 18px; margin-bottom u: none; .dashboard-section h3 {font-size: 18px; margin-bottom: 5px;}""") as iface:
153
  gr.Markdown("<h1>LabOps Log Analyzer Dashboard (Hugging Face AI)</h1>")
154
  gr.Markdown("Upload a CSV file containing lab equipment logs to analyze usage.")
155
  with gr.Row():
 
72
  reminder_lines.append(f" AMC Date: {row['amc_date']}")
73
  reminder_lines.append("---")
74
  reminder_list = "\n".join(reminder_lines)
75
+ logging.info("CSS remi: none; logging.info("AMC reminders generated successfully")
76
  return reminder_list
77
  except Exception as e:
78
  logging.error(f"AMC reminder generation failed: {str(e)}")
 
82
  try:
83
  total_devices = df["device_id"].nunique()
84
  avg_usage = df["usage_hours"].mean() if "usage_hours" in df.columns else 0
85
+ prompt = (f"Generate executive-level insights. There were {total_devices} devices with an average usage of {avg_usage:.2f} hours.")
86
  insights = summarizer(prompt, max_length=150, do_sample=False)[0]["generated_text"]
87
  logging.info("Dashboard insights generated successfully")
88
  return insights
 
110
  return "No file uploaded.", "No data to preview.", None, "No anomalies detected.", "No AMC reminders.", "No insights generated."
111
  file_name = file_obj.name if hasattr(file_obj, 'name') else file_obj
112
  logging.info(f"Processing file: {file_name}")
 
113
  if not file_name.endswith(".csv"):
114
  logging.error("Unsupported file format")
115
  return "Unsupported file format. Please upload a CSV file.", None, None, None, None, None
 
148
 
149
  try:
150
  logging.info("Initializing Gradio Blocks interface...")
151
+ with gr.Blocks(css=""".dashboard-container {border: 1px solid #e0e0e0; padding: 10px; border-radius: 5px; background-color: #f9f9f9;} .dashboard-title {font-size: 24px; font-weight: bold; margin-bottom: 10px;} .dashboard-section {margin-bottom: 15px;} .dashboard-section h3 {font-size: 18px; margin-bottom: 5px;}""") as iface:
152
  gr.Markdown("<h1>LabOps Log Analyzer Dashboard (Hugging Face AI)</h1>")
153
  gr.Markdown("Upload a CSV file containing lab equipment logs to analyze usage.")
154
  with gr.Row():