Spaces:
Sleeping
Sleeping
Download src/benchmark_utils.py from bichle/ML_Final_Hourly: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/spaces/bichle/ML_Final_Hourly/resolve/refs%2Fpr%2F1/src/benchmark_utils.py
- Command line
-
hf download hf://spaces/bichle/ML_Final_Hourly@refs/pr/1/src/benchmark_utils.py
-
curl -L -o benchmark_utils.py https://huggingface.co/spaces/bichle/ML_Final_Hourly/resolve/refs%2Fpr%2F1/src/benchmark_utils.py
1.25 kB
| import pandas as pd | |
| import streamlit as st | |
| def load_leaderboard(file_path="data/results_df_all_tuned.csv"): | |
| """ | |
| Tải và xử lý file CSV chứa kết quả leaderboard của các mô hình. | |
| Args: | |
| file_path (str): Đường dẫn đến file CSV leaderboard. | |
| Returns: | |
| pd.DataFrame: DataFrame đã được sắp xếp, sẵn sàng để hiển thị. | |
| """ | |
| try: | |
| df = pd.read_csv(file_path) | |
| SORT_COLUMN_NAME = 'RMSE (Absolute Error)' | |
| if SORT_COLUMN_NAME in df.columns: | |
| df_sorted = df.sort_values(by=SORT_COLUMN_NAME, ascending=True) | |
| else: | |
| st.warning(f"Không tìm thấy cột '{SORT_COLUMN_NAME}' để sắp xếp leaderboard. " | |
| f"Vui lòng kiểm tra file `src/benchmark_utils.py`.") | |
| df_sorted = df | |
| return df_sorted | |
| except FileNotFoundError: | |
| st.error(f"LỖI: Không tìm thấy file leaderboard tại đường dẫn: {file_path}") | |
| return pd.DataFrame() # Trả về DataFrame rỗng nếu có lỗi | |
| except Exception as e: | |
| st.error(f"Lỗi khi tải leaderboard: {e}") | |
| return pd.DataFrame() |