Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -441,7 +441,7 @@ def generate_pdf_content(summary, preview_df, anomalies, amc_reminders, insights
|
|
| 441 |
|
| 442 |
story.append(Paragraph("Log Preview", styles['Heading2']))
|
| 443 |
if not preview_df.empty:
|
| 444 |
-
data = [preview_df.columns.tolist()] + preview_df.values.tolist()
|
| 445 |
table = Table(data)
|
| 446 |
table.setStyle(TableStyle([
|
| 447 |
('BACKGROUND', (0, 0), (-1, 0), colors.grey),
|
|
@@ -558,8 +558,8 @@ async def process_logs(file_obj, lab_site_filter, equipment_type_filter, date_ra
|
|
| 558 |
if filtered_df.empty:
|
| 559 |
return "No data after applying filters.", "<p>No data after filters.</p>", None, '<p>No device cards available.</p>', None, None, None, None, "", "", "", None, df, current_modified_time
|
| 560 |
|
| 561 |
-
# Generate table for preview
|
| 562 |
-
preview_df = filtered_df[['device_id', 'log_type', 'status', 'timestamp', 'usage_hours', 'downtime', 'amc_date']]
|
| 563 |
preview_html = preview_df.to_html(index=False, classes='table table-striped', border=0)
|
| 564 |
|
| 565 |
# Run critical tasks concurrently
|
|
|
|
| 441 |
|
| 442 |
story.append(Paragraph("Log Preview", styles['Heading2']))
|
| 443 |
if not preview_df.empty:
|
| 444 |
+
data = [preview_df.columns.tolist()] + preview_df.head(5).values.tolist()
|
| 445 |
table = Table(data)
|
| 446 |
table.setStyle(TableStyle([
|
| 447 |
('BACKGROUND', (0, 0), (-1, 0), colors.grey),
|
|
|
|
| 558 |
if filtered_df.empty:
|
| 559 |
return "No data after applying filters.", "<p>No data after filters.</p>", None, '<p>No device cards available.</p>', None, None, None, None, "", "", "", None, df, current_modified_time
|
| 560 |
|
| 561 |
+
# Generate table for preview
|
| 562 |
+
preview_df = filtered_df[['device_id', 'log_type', 'status', 'timestamp', 'usage_hours', 'downtime', 'amc_date']].head(5)
|
| 563 |
preview_html = preview_df.to_html(index=False, classes='table table-striped', border=0)
|
| 564 |
|
| 565 |
# Run critical tasks concurrently
|