Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/hf-space-deploy.yml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
name: HF Space deploy

# Pushes scripts/hf_space/ to the HF Space at
# https://huggingface.co/spaces/OpenChainBench/leaderboard.
#
# Trigger:
# - push to main that touches scripts/hf_space/**
# - workflow_dispatch for manual redeploys
#
# Required secrets:
# HF_TOKEN write-scoped token for the Space repo (same token as the
# dataset publisher).

on:
push:
branches: [main]
paths:
- "scripts/hf_space/**"
- ".github/workflows/hf-space-deploy.yml"
workflow_dispatch:

concurrency:
group: hf-space-deploy
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
HF_SPACE_REPO_ID: OpenChainBench/leaderboard
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install huggingface_hub
run: pip install "huggingface_hub>=0.26"

- name: Upload to HF Space
env:
GIT_SHA: ${{ github.sha }}
run: |
python - <<'PY'
import os
from huggingface_hub import HfApi

token = os.environ["HF_TOKEN"]
repo_id = os.environ["HF_SPACE_REPO_ID"]
sha = os.environ.get("GIT_SHA", "manual")
api = HfApi(token=token)
api.create_repo(
repo_id=repo_id,
repo_type="space",
space_sdk="gradio",
exist_ok=True,
private=False,
)
info = api.upload_folder(
folder_path="scripts/hf_space",
repo_id=repo_id,
repo_type="space",
commit_message=f"deploy from {sha}",
)
print("uploaded:", getattr(info, "oid", "ok"))
PY

- name: Summary
if: always()
run: |
{
echo "## HF Space deploy ${{ job.status }}"
echo ""
echo "**Space:** https://huggingface.co/spaces/${HF_SPACE_REPO_ID}"
echo "**Commit:** ${{ github.sha }}"
echo "**Time:** $(date -u +%FT%TZ)"
} >> "$GITHUB_STEP_SUMMARY"
3 changes: 2 additions & 1 deletion .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,7 +62,8 @@ harnesses/*/monitor
harnesses/*/cmd/script/script
harnesses/*/cmd/monitor/monitor

# Python venvs for the HF publisher (created locally for dry-runs)
# Python venvs for the HF publisher and Space (created locally for dry-runs)
scripts/hf_publisher/.venv/
scripts/hf_space/.venv/
**/__pycache__/
*.pyc
52 changes: 52 additions & 0 deletions scripts/hf_space/README.md
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
---
title: OpenChainBench Leaderboard
emoji: 📊
colorFrom: indigo
colorTo: blue
sdk: gradio
sdk_version: 4.44.1
python_version: "3.11"
app_file: app.py
license: cc-by-4.0
pinned: false
short_description: Interactive leaderboard for OpenChainBench crypto infra benchmarks
---

# OpenChainBench leaderboard

A small Gradio app that reads the daily parquet snapshot from the
[OpenChainBench/benchmarks](https://huggingface.co/datasets/OpenChainBench/benchmarks)
dataset and lets you browse it. Four tabs: today's leaderboard, per-chain
leaders, per-provider rankings, and an about page.

The dataset itself is the source of truth. This Space is a viewer on top
of it. If you want raw access, query the parquet files directly with
`polars`, `duckdb`, `pandas`, or any tool that speaks parquet.

```python
import polars as pl

df = pl.scan_parquet(
"hf://datasets/OpenChainBench/benchmarks/headlines/**/*.parquet",
hive_partitioning=True,
)
print(df.collect().head())
```

For the full website with methodology, per-bench detail pages, and the
historical view, head to [openchainbench.com](https://openchainbench.com).

## Local dev

```bash
pip install -r requirements.txt
python app.py
```

Open http://127.0.0.1:7860.

## License

Code in this Space is part of the OpenChainBench repo. The dataset is
released under CC-BY-4.0. Attribution: link back to openchainbench.com or
the dataset page.
Loading
Loading