Rom89823974978 commited on
Commit
ce9fe2d
Β·
1 Parent(s): fc910c8

Updated dockerfile, run.sh and readme file to fit with hugginggface space

Browse files
Files changed (3) hide show
  1. Dockerfile +33 -20
  2. README.md +11 -0
  3. run.sh +55 -0
Dockerfile CHANGED
@@ -5,28 +5,35 @@
5
  ########################
6
  FROM python:3.10-slim AS runtime
7
 
8
- # -- Environment hygiene ---------------------------------------------------
9
  ENV PYTHONDONTWRITEBYTECODE=1 \
10
  PYTHONUNBUFFERED=1 \
11
  PIP_DISABLE_PIP_VERSION_CHECK=1 \
12
- PIP_NO_CACHE_DIR=1
 
 
 
13
 
14
- # -- System deps -----------------------------------------------------------
15
  RUN apt-get update && \
16
  apt-get install -y --no-install-recommends \
17
- git build-essential && \
18
- rm -rf /var/lib/apt/lists/*
 
 
19
 
20
- # -- Python deps -----------------------------------------------------------
21
  WORKDIR /app
22
  COPY requirements.txt .
23
- RUN pip install --upgrade pip && pip install -r requirements.txt
 
24
 
25
- # -- Project code ----------------------------------------------------------
26
  COPY . .
27
 
28
- # ---- Default entrypoint (can be over-ridden) ----
29
- CMD ["python", "-m", "evaluation.pipeline"]
 
30
 
31
 
32
  ########################
@@ -34,19 +41,25 @@ CMD ["python", "-m", "evaluation.pipeline"]
34
  ########################
35
  FROM runtime AS dev
36
 
37
- # Add extra tooling useful during development & CI
38
  RUN pip install \
39
  black isort flake8 pytest \
40
  mkdocs-material
41
 
42
- # Drop into an interactive shell by default
43
  CMD ["/bin/bash"]
44
 
45
-
46
- # Production container (minimal)
47
- #docker build -t rag-eval .
48
- #docker run --rm rag-eval --help
49
-
50
- # Development container (with lint / test / docs tooling)
51
- #docker build -t rag-eval-dev --target dev .
52
- #docker run --rm -it rag-eval-dev
 
 
 
 
 
 
 
5
  ########################
6
  FROM python:3.10-slim AS runtime
7
 
8
+ # ── Environment hygiene ────────────────────────────────────────────────────
9
  ENV PYTHONDONTWRITEBYTECODE=1 \
10
  PYTHONUNBUFFERED=1 \
11
  PIP_DISABLE_PIP_VERSION_CHECK=1 \
12
+ PIP_NO_CACHE_DIR=1 \
13
+ # Streamlit: suppress browser launch & telemetry inside container
14
+ STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
15
+ STREAMLIT_SERVER_HEADLESS=true
16
 
17
+ # ── System deps ────────────────────────────────────────────────────────────
18
  RUN apt-get update && \
19
  apt-get install -y --no-install-recommends \
20
+ git build-essential \
21
+ openjdk-17-jre-headless \
22
+ curl \
23
+ && rm -rf /var/lib/apt/lists/*
24
 
25
+ # ── Python deps ────────────────────────────────────────────────────────────
26
  WORKDIR /app
27
  COPY requirements.txt .
28
+ RUN pip install --upgrade pip && pip install -r requirements.txt \
29
+ && pip install streamlit
30
 
31
+ # ── Project code ──────────────────────────────────────────────────────────
32
  COPY . .
33
 
34
+ # ── Default entrypoint β†’ Streamlit dashboard ─────────────────────────────
35
+ EXPOSE 8501
36
+ ENTRYPOINT ["streamlit", "run", "scripts/dashboard.py", "--server.port", "8501", "--server.address", "0.0.0.0"]
37
 
38
 
39
  ########################
 
41
  ########################
42
  FROM runtime AS dev
43
 
44
+ # Extra tooling for development & CI
45
  RUN pip install \
46
  black isort flake8 pytest \
47
  mkdocs-material
48
 
49
+ # Default to an interactive shell
50
  CMD ["/bin/bash"]
51
 
52
+ ###########################################################################
53
+ # Build / run cheat-sheet #
54
+ # ----------------------------------------------------------------------- #
55
+ # Production container (dashboard): #
56
+ # docker build -t rag-eval . #
57
+ # docker run -p 8501:8501 rag-eval #
58
+ # #
59
+ # Alternative CLI usage: #
60
+ # docker run --rm rag-eval python scripts/run_experiments.py --help #
61
+ # #
62
+ # Development container (with lint/test/docs tools): #
63
+ # docker build -t rag-eval-dev --target dev . #
64
+ # docker run --rm -it rag-eval-dev #
65
+ ###########################################################################
README.md CHANGED
@@ -1,4 +1,15 @@
 
 
 
 
 
 
 
 
 
1
  ````markdown
 
 
2
  # Retrieval-Augmented Generation Evaluation Framework
3
  *(Legal & Financial domains, with full regulatory-grade metrics and dashboard)*
4
 
 
1
+ ---
2
+ title: Regulated Domain RAG Evaluation
3
+ emoji: πŸ€–
4
+ colorFrom: purple
5
+ colorTo: indigo
6
+ sdk: docker
7
+ app_port: 8501
8
+ pinned: false
9
+ ---
10
  ````markdown
11
+ Hugginface spaces setup
12
+
13
  # Retrieval-Augmented Generation Evaluation Framework
14
  *(Legal & Financial domains, with full regulatory-grade metrics and dashboard)*
15
 
run.sh ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # run.sh
3
+
4
+ set -euo pipefail
5
+
6
+ # ---- utils ---------------------------------------------------------------
7
+ die() { echo "❌ $*" >&2; exit 1; }
8
+
9
+ exists() { command -v "$1" >/dev/null 2>&1; }
10
+
11
+ PY=python
12
+ [ -n "${VIRTUAL_ENV-}" ] || die "Activate your virtualenv first (python deps)."
13
+
14
+ CMD=${1:-}
15
+ shift || true # remove first arg if present
16
+
17
+ case "${CMD}" in
18
+ single)
19
+ CONFIG=${1:-}; QUERIES=${2:-}
20
+ [ -f "$CONFIG" ] || die "Config YAML not found: $CONFIG"
21
+ [ -f "$QUERIES" ] || die "Queries JSONL not found: $QUERIES"
22
+ shift 2
23
+ ${PY} scripts/run_experiments.py --config "$CONFIG" --queries "$QUERIES" "$@"
24
+ ;;
25
+
26
+ grid)
27
+ CONFIGS=${1:-}
28
+ DATASETS=${2:-}
29
+ shift 2
30
+ ${PY} scripts/run_grid_experiments.py --configs ${CONFIGS} --datasets ${DATASETS} "$@"
31
+ ;;
32
+
33
+ dashboard)
34
+ if [[ "${1:-}" == "--docker" ]]; then
35
+ docker build -t rag-eval . # uses Dockerfile default (Streamlit)
36
+ docker run -p 8501:8501 rag-eval
37
+ else
38
+ streamlit run scripts/dashboard.py
39
+ fi
40
+ ;;
41
+
42
+ *)
43
+ cat <<EOF
44
+ Usage: ./run.sh <mode> [args]
45
+
46
+ Modes
47
+ -----
48
+ single CONFIG QUERIES [extra run_experiments.py flags]
49
+ grid CONFIG_GLOB DATASET_GLOB [extra grid flags]
50
+ dashboard [--docker] # without flag runs locally
51
+
52
+ EOF
53
+ [ -n "$CMD" ] && die "Unknown mode: $CMD"
54
+ ;;
55
+ esac