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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -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 = (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,6 +110,7 @@ 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
  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,7 +149,7 @@ def process_logs(file_obj):
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: #f9fburn: none; .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():
 
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
  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
 
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():