constantinSch/evaluation_summarization
Evaluation Summarization Space
This repository contains a Docker-based Hugging Face Space for evaluating generated summaries against source transcripts. The app serves a lightweight annotation interface backed by Flask and stores submitted judgements in SQLite.
What the Space does
- Presents evaluation items from a JSONL dataset.
- Lets annotators score summary quality across multiple criteria.
- Persists annotations in a SQLite database.
- Exports collected annotations as JSONL.
- Supports optional password protection through a Space secret.
Runtime model
This Space uses the docker SDK and starts the Flask app defined in app.py. The container exposes port 7860, which is declared in the YAML front matter above and in Dockerfile.
At runtime, the app reads:
DATASET_PATHfor the evaluation dataset JSONLDB_PATHfor the SQLite annotations databaseAPP_PASSWORDfor optional login protectionSECRET_KEYfor stable HMAC token generation
By default, the Docker image is configured for Hugging Face persistent storage mounted at /data:
- dataset:
/data/2026-04-23_prompt_evaluation_dataset.jsonl - annotations DB:
/data/annotations.db
Deploying on Hugging Face Spaces
- Create a new Space using the
DockerSDK. - Add persistent storage mounted at
/data. - Set the secret
APP_PASSWORDif the UI should require a login. - Set the secret
SECRET_KEYif you want authentication tokens to remain valid across container restarts. - Push this repository to the Space.
- Upload the dataset JSONL into
/data/in the Space storage browser. - Confirm that the uploaded dataset filename matches
DATASET_PATHin Dockerfile.
Without persistent storage, annotations stored in SQLite will be lost when the container filesystem is replaced.
Recovering a damaged annotations database
If PRAGMA integrity_check; reports corruption, stop the app first and work on a copy of the database files, not on the live files in /data.
Run the recovery script from the repository root:
uv run python recover_annotations_db.py data/annotations.db data/annotations.recovered.db --forceThe script stages annotations.db plus sibling -wal and -shm files into a temporary directory, copies all readable rows from the annotations table into a new clean database, and prints a recovery report including integrity-check results.
After a successful run:
- stop the app
- keep a backup of the old
annotations.db,annotations.db-wal, andannotations.db-shm - replace only
annotations.dbwith the recovered file - remove old
annotations.db-walandannotations.db-shm - restart the app
The application now uses a real SQLite upsert for annotation writes, so updating an existing eval_id no longer performs the delete-and-reinsert behavior of INSERT OR REPLACE.
Local development
The app can also run locally. In local development, it defaults to the dataset file in the project root when DATASET_PATH is unset.
Example environment variables:
$env:DATASET_PATH = "2026-04-23_prompt_evaluation_dataset.jsonl"
$env:DB_PATH = "annotations.db"
$env:APP_PASSWORD = "your-password"
python app.pyThe Python dependency is defined in pyproject.toml. The container build uses uv as configured in Dockerfile.
Data expectations
The dataset is expected to be a JSONL file with one evaluation item per line. The application relies on stable item IDs and the text fields required to render the transcript, summary, and metadata shown in the UI.
Submitted annotations are stored by eval_id and include these fields:
bewertungkorrektrelevantvollstaendigkohaerenzanmerkungen
If you replace the dataset with a new file that uses different eval_id values, existing annotation rows in the SQLite database will no longer line up with the new items.
Notes for duplication
If someone duplicates this Space, the most important setup steps are:
- mount persistent storage at
/data - upload a dataset JSONL file to
/data - keep
DATASET_PATHaligned with the uploaded filename - configure
APP_PASSWORDif access should be restricted
For Hugging Face Space metadata options, see the Spaces configuration reference:
https://huggingface.co/docs/hub/spaces-config-reference
