|
import os |
|
import pandas as pd |
|
import streamlit as st |
|
import huggingface_hub as hh |
|
|
|
|
|
OWNER = "Booking-com" |
|
REPO_ID = f"{OWNER}/streamlit-review-ranking-leaderboard" |
|
RESULTS_REPO = f"{OWNER}/results" |
|
TOKEN = os.environ.get("HF_TOKEN") |
|
CACHE_PATH = os.getenv("HF_HOME", ".") |
|
EVAL_RESULTS_PATH = os.path.join(CACHE_PATH, "eval-results") |
|
|
|
API = hh.HfApi(token=TOKEN) |
|
|
|
|
|
def restart_space(): |
|
API.restart_space(repo_id=REPO_ID) |
|
|
|
|
|
hh.snapshot_download( |
|
repo_id=RESULTS_REPO, local_dir=EVAL_RESULTS_PATH, repo_type=None, tqdm_class=None, etag_timeout=30, |
|
token=TOKEN |
|
) |
|
|
|
|
|
def render(): |
|
st.set_page_config(page_title="RecTour2024 - Booking.com Review Ranking Challenge Leaderboard", layout="wide") |
|
st.title("π RecTour2024 Leaderboard") |
|
df_results = pd.read_csv(os.path.join(EVAL_RESULTS_PATH, 'results.csv')) |
|
st.table(df_results) |
|
|
|
|
|
if __name__ == "__main__": |
|
render() |
|
|
|
|