Computer-Science / README.md
shaico111's picture
Add files using upload-large-folder tool
97a6ab5 verified
|
Raw History Blame
3.27 kB

CS26 — Computer-Science Dataset + Portal

This repo contains:

  • A Hugging Face Dataset: CS26/Computer-Science
  • A Hugging Face Space (portal): CS26/cs26-portal (Gradio)

The portal is live at:

  • Direct app URL: https://cs26-cs26-portal.hf.space/
  • Space page: https://huggingface.co/spaces/CS26/cs26-portal

Authentication (no tokens in repos)

Do not hardcode any hf_... tokens in code or commit them to git.

Use the Hugging Face CLI to store your token locally:

hf auth login --force
hf auth whoami

This stores credentials in your user profile cache and lets huggingface_hub authenticate automatically.

Portal (Space) — cs26-portal/app.py

Features:

  • RTL + Hebrew UI (including mixed Hebrew / Latin in search headings)
  • Folder navigation with breadcrumbs
  • Stateful refresh and deep links: current folder is stored in the ?path= query string (URL-encoded), with # kept in sync for refresh-friendly navigation, plus a localStorage copy for resilience
  • Search within current folder subtree
  • File actions on click:
    • PDF: downloads immediately
    • ZIP/archives: download immediately
    • Office (doc/docx/ppt/pptx): opens OfficeApps viewer in a new tab, and shows a preview pane with “הורדה” + “תצוגה (Office)”
    • Images: in-page preview + download link
    • Text/code (txt/c/...): in-page preview + download link
  • Prepare Folder ZIP: builds a ZIP from the dataset via snapshot_download / temp zip; status and errors are shown in a status markdown area next to the download widget
  • Direct Hugging Face downloads: filenames with Hebrew (or other non-ASCII) may still appear percent-encoded in some browsers when downloading straight from huggingface.co URLs; the app uses best-effort <a download> where applicable

Deploy the Space

From repo root:

python .\upload_space.py

Troubleshooting

  • Search shows nothing: search is scoped to the current folder subtree; navigate into a year or topic folder first, or clear the search box and use רענון after changing folders.
  • ZIP errors or long waits: large folders download many files from Hugging Face first; watch the status markdown under the ZIP button for progress or a Python traceback if something fails.
  • Blank preview for images: raster previews are embedded as data URIs when needed; if something still fails, use the dataset resolve link from the preview panel.

Dataset uploader — upload_to_hf.py

Uploads the local folder to the dataset repo in batches of 10 files with retry/resume.

It excludes:

  • .git/**
  • cs26-portal/**
  • upload_to_hf.py, upload_space.py

Run:

python .\upload_to_hf.py

Optional environment variables:

  • HF_REPO_ID (default CS26/Computer-Science)
  • HF_LOCAL_FOLDER (default c:\GitRepos\Computer-Science)
  • HF_BATCH_SIZE (default 10)
  • HF_RETRY_SLEEP_SECONDS (default 5)

Rollback safety

Local repo has:

  • tag: backup-before-portal-fixes
  • branch: backup/current-state

Space repo has:

  • tag: backup-before-portal-fixes
  • branch: backup/current-state
  • tag: latest pointing at current main HEAD