Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -390,12 +390,25 @@ def process_dataframe(df):
|
|
| 390 |
|
| 391 |
@app.route("/report")
|
| 392 |
def report_view():
|
| 393 |
-
|
| 394 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
|
|
|
|
|
|
| 399 |
|
| 400 |
# 3. build df & html
|
| 401 |
df = pd.DataFrame({
|
|
|
|
| 390 |
|
| 391 |
@app.route("/report")
|
| 392 |
def report_view():
|
| 393 |
+
|
| 394 |
+
report_type = request.args.get('report_type', 'pred')
|
| 395 |
+
try:
|
| 396 |
+
page = int(request.args.get('page', 1))
|
| 397 |
+
except ValueError:
|
| 398 |
+
page = 1
|
| 399 |
+
per_page = 15 # records per page
|
| 400 |
+
|
| 401 |
+
# Read the appropriate CSV file.
|
| 402 |
+
if report_type == 'pred':
|
| 403 |
+
df = pd.read_csv(PRED_OUTPUT_FILE)
|
| 404 |
+
else:
|
| 405 |
+
df = pd.read_csv(CLASS_OUTPUT_FILE)
|
| 406 |
|
| 407 |
+
start_idx = (page - 1) * per_page
|
| 408 |
+
end_idx = start_idx + per_page
|
| 409 |
+
total_records = len(df)
|
| 410 |
+
|
| 411 |
+
df_page = df.iloc[start_idx:end_idx]
|
| 412 |
|
| 413 |
# 3. build df & html
|
| 414 |
df = pd.DataFrame({
|