Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -141,7 +141,9 @@ def generate_pdf_content(summary, preview, anomalies, amc_reminders, insights):
|
|
| 141 |
\setlength{\parskip}{0.5em}
|
| 142 |
\setlength{\parindent}{0em}
|
| 143 |
\usepackage{titling}
|
| 144 |
-
\usepackage{xcolor
|
|
|
|
|
|
|
| 145 |
\usepackage{noto}
|
| 146 |
|
| 147 |
\title{LabOps Log Analysis Report}
|
|
@@ -172,7 +174,7 @@ def generate_pdf_content(summary, preview, anomalies, amc_reminders, insights):
|
|
| 172 |
return latex_content
|
| 173 |
|
| 174 |
# Main Gradio function
|
| 175 |
-
async def process_logs(file_obj,
|
| 176 |
try:
|
| 177 |
progress(0, "Starting file processing...")
|
| 178 |
if file_obj is None:
|
|
@@ -197,8 +199,8 @@ async def process_logs(file_obj, row_limit=10000, progress=gr.Progress()):
|
|
| 197 |
"downtime": "float32",
|
| 198 |
"amc_date": "string"
|
| 199 |
}
|
| 200 |
-
df = pd.read_csv(file_name, usecols=usecols, dtype=dtypes
|
| 201 |
-
logging.info(f"File loaded successfully with {len(df)} rows
|
| 202 |
except Exception as e:
|
| 203 |
logging.error(f"Failed to load CSV: {str(e)}")
|
| 204 |
return f"Failed to load CSV: {str(e)}", None, None, None, None, None, None
|
|
@@ -274,7 +276,6 @@ try:
|
|
| 274 |
with gr.Row():
|
| 275 |
with gr.Column(scale=1):
|
| 276 |
file_input = gr.File(label="Upload Logs (CSV)", file_types=[".csv"])
|
| 277 |
-
row_limit = gr.Number(label="Row Limit (Max Records to Process)", value=10000, precision=0)
|
| 278 |
submit_button = gr.Button("Analyze", variant="primary")
|
| 279 |
|
| 280 |
with gr.Column(scale=2):
|
|
@@ -318,7 +319,7 @@ try:
|
|
| 318 |
|
| 319 |
submit_button.click(
|
| 320 |
fn=process_logs,
|
| 321 |
-
inputs=[file_input
|
| 322 |
outputs=[summary_output, preview_output, chart_output, anomaly_output, amc_output, insights_output, pdf_output]
|
| 323 |
)
|
| 324 |
|
|
|
|
| 141 |
\setlength{\parskip}{0.5em}
|
| 142 |
\setlength{\parindent}{0em}
|
| 143 |
\usepackage{titling}
|
| 144 |
+
\usepackage{xcolor彼此
|
| 145 |
+
|
| 146 |
+
System: color}
|
| 147 |
\usepackage{noto}
|
| 148 |
|
| 149 |
\title{LabOps Log Analysis Report}
|
|
|
|
| 174 |
return latex_content
|
| 175 |
|
| 176 |
# Main Gradio function
|
| 177 |
+
async def process_logs(file_obj, progress=gr.Progress()):
|
| 178 |
try:
|
| 179 |
progress(0, "Starting file processing...")
|
| 180 |
if file_obj is None:
|
|
|
|
| 199 |
"downtime": "float32",
|
| 200 |
"amc_date": "string"
|
| 201 |
}
|
| 202 |
+
df = pd.read_csv(file_name, usecols=usecols, dtype=dtypes)
|
| 203 |
+
logging.info(f"File loaded successfully with {len(df)} rows")
|
| 204 |
except Exception as e:
|
| 205 |
logging.error(f"Failed to load CSV: {str(e)}")
|
| 206 |
return f"Failed to load CSV: {str(e)}", None, None, None, None, None, None
|
|
|
|
| 276 |
with gr.Row():
|
| 277 |
with gr.Column(scale=1):
|
| 278 |
file_input = gr.File(label="Upload Logs (CSV)", file_types=[".csv"])
|
|
|
|
| 279 |
submit_button = gr.Button("Analyze", variant="primary")
|
| 280 |
|
| 281 |
with gr.Column(scale=2):
|
|
|
|
| 319 |
|
| 320 |
submit_button.click(
|
| 321 |
fn=process_logs,
|
| 322 |
+
inputs=[file_input],
|
| 323 |
outputs=[summary_output, preview_output, chart_output, anomaly_output, amc_output, insights_output, pdf_output]
|
| 324 |
)
|
| 325 |
|