Spaces:
Runtime error
Runtime error
A newer version of the Gradio SDK is available: 6.22.0
metadata
title: Github Repo Stats
emoji: 🩻
colorFrom: indigo
colorTo: yellow
sdk: gradio
sdk_version: 6.9.0
app_file: app.py
pinned: false
short_description: Visualize lines of code by language for a GitHub repo
Github Repo Stats 🩻
A simple app (deployed on HF spaces) to visualize lines of code by language and other basic stats for any public GitHub repo.
Why Make It
I was kinda annoyed that it doesn't exist already, or at least not in the way I imagined.
The issue with GitHub's language breakdown is that it approximates language contribution based on file size, not actual lines of code -- especially noticeable with Jupyter notebooks. This app fixes that by counting actual lines.
How It Works
- Fetches the full file tree via the GitHub API
- Filters out binary files, vendored directories (
node_modules,vendor,dist, etc.), and non-code files - Downloads each source file from
raw.githubusercontent.comconcurrently, largest files first so the live breakdown stabilizes early instead of jumping when a big file lands late - Counts newlines in each file, mapping file extensions to languages
- Pulls weekly commit counts over the repo's full lifetime via
/stats/contributorsand renders them as a block-character histogram below the language chart
Running Locally
pip install -r requirements.txt
python app.py
Optionally set a GITHUB_TOKEN environment variable to avoid GitHub API rate limits and to reliably fetch the commit history:
export GITHUB_TOKEN=ghp_...
python app.py
LICENSE
MIT <3