CoolFace
Apppublic

shreya518/commit-message-poet

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes
App README

๐ŸŽ‹ Commit Message Poet

Paste a git diff, get a poem about your code โ€” plus a clean Conventional Commit message underneath. A tiny, free web app.

Quiet code at rest โ€” the null check now stands guard where the login once crashed fix(auth): guard against missing session

Why it exists

Writing commit messages is a chore, so I taught a web app to write me a haiku about my diff first. The surprise: reading the poem made me actually re-read my own changes โ€” and the Conventional Commit line underneath keeps my git history clean and searchable.

100% free

Runs on Google Gemini's free tier. No paid API, no credit card. If the free quota is briefly maxed out (e.g. lots of people using it at once), it shows a friendly sample instead of ever breaking.

Try it

Online: (add your Hugging Face Space URL here after deploying)

Locally:

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

Set your key first โ€” PowerShell: $env:GEMINI_API_KEY="your_free_key" ยท macOS/Linux: export GEMINI_API_KEY=your_free_key. (On Hugging Face Spaces, Gradio is provided via sdk_version, so requirements.txt only lists the Gemini client.)

Get a free key at <https://aistudio.google.com/app/apikey>.

Deploy your own (free, ~5 min)

  1. 1.Create a new Gradio Space at <https://huggingface.co/new-space>.
  2. 2.Upload app.py, poet.py, samples.py, requirements.txt, and this README.md.
  3. 3.In the Space's Settings โ†’ Secrets, add GEMINI_API_KEY with your free key.
  4. 4.The Space builds and goes live at a public URL. Done.

The key lives as a Space secret โ€” it is never in the code and never exposed to visitors.

How it works

git diff  โ†’  trim/summarize (keeps filenames + key hunks)
          โ†’  prompt Gemini for a grounded poem + a Conventional Commit line
          โ†’  graceful sample fallback if the model is unavailable

Files:

  • โ€”poet.py โ€” diff trimming, prompt, Gemini call, fallback (UI-agnostic core)
  • โ€”app.py โ€” the Gradio web UI
  • โ€”samples.py โ€” example diffs so visitors can try it with one click

Config

Env varDefaultPurpose
GEMINI_API_KEY(none)Your free Gemini key. Without it, the app shows samples.
GEMINI_MODELgemini-2.5-flashWhich free Gemini model to use.