HuggingPolls / README.md
Banaxi-Tech's picture Hoglet-33's picture
Revamp (#1)
c8876d8
|
Raw History Blame Contribute Delete
4.85 kB
metadata
title: HuggingPolls
emoji: 🗳️
colorFrom: yellow
colorTo: green
sdk: docker
app_port: 7860
hf_oauth: true
hf_oauth_expiration_minutes: 480
suggested_hardware: cpu-basic
thumbnail: static/logo.png
pinned: false

HuggingPolls

Sign in with Hugging Face to create polls, share https://huggingface.co/spaces/Banaxi-Tech/HuggingPolls#POLL_ID, and manage results. Guests and signed-in users can vote. Creators can see totals and percentages, export CSV, close/reopen, and delete their polls. Uses the supplied Judge Huggy logo.

HuggingPolls is an independent community project. It is not affiliated with, endorsed by, or sponsored by Hugging Face.

Appearance and drafts

The app follows your system's light or dark appearance by default and updates when the system appearance changes. Use Theme at the bottom of any page to choose System, Light, or Dark. Your choice is remembered in this browser and applied before the page appears.

Poll drafts save automatically in the current tab while you type, including when you navigate away, reload, or return from sign-in. Use Clear draft to start over. Drafts are cleared after a poll is created and are not sent to the server until you submit. The form shows the question length and available option count, checks for blank or duplicate answers, and supports up to 12 options.

Browse polls and voting deadlines

Open See polls to browse without signing in. Search questions, descriptions, or creators; filter open or closed polls; and sort by newest, most votes, or ending soon. Results appear in pages of 12 polls.

New polls are listed by default and expire after 7 days. Choose 1 hour, 1 day, 3 days, 7 days, or 30 days when creating a poll. Deadlines start at creation and are enforced by the server on every vote, including requests from an old browser tab. Expiry ends voting and keeps the poll and its final results available. Expired polls cannot reopen; manually closed polls can reopen until their deadline.

Turn off List on See polls for a poll that is only shared by link. Creators can later use List publicly or Unlist poll on their poll page. Existing polls keep their original links, have no scheduled deadline, and stay unlisted unless their creator lists them.

Run on a CPU Basic Docker Space

Upload this folder to a Docker Space. The metadata enables Hugging Face OAuth automatically. Set these Space secrets:

  • SESSION_SECRET: a long random value, kept stable across restarts.
  • DATA_TOKEN: a Hugging Face write token scoped to the private data dataset.

Set the Space variable DATA_REPO to a private dataset repository, such as your-name/HuggingPolls-data. Each accepted mutation is saved there before success is returned. The private dataset contains poll data and hashed voter identifiers; do not make it public. This small-app snapshot storage is designed for a single CPU instance and one Uvicorn worker, with up to 100 polls per account and 10,000 votes per poll. It creates a dataset commit per mutation, so heavy traffic needs a database instead.

Without DATA_REPO, data is saved locally and can be lost when the Space restarts. No paid hardware or persistent disk is required when using the private dataset.

Local run

Install requirements.txt, then run uvicorn app:app --host 0.0.0.0 --port 7860. Local sign-in requires your own HF OAuth client credentials (OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, BASE_URL) with a matching callback URL /auth/callback. On Spaces those OAuth credentials are injected automatically.

Voting and privacy

Each browser receives a signed anonymous identifier. Signed-in votes are also associated with a hashed HF identity. Results are available to the creator at any time, to voters after they vote, and to everyone once voting closes or expires, enforced on the server. CSV exports and management controls are restricted to the creator. No access tokens, email addresses, or raw account IDs of voters are saved. Creators' account IDs and usernames are saved for ownership. Anyone with the link can see the question and options. Listed polls also appear in public browsing; unlisted polls remain accessible to anyone with their link. Guest repeat-vote prevention is browser-based: clearing cookies or using a different browser can bypass it. These are casual polls, not verified elections.

Open the app directly at its hf.space URL for sign-in: embedded browsers can block the cookies required by OAuth. Copied poll links use the normal huggingface.co/spaces/OWNER/SPACE#POLL_ID URL.

Checks

With the app's requirements installed, run python -m unittest discover -s tests -v. The tests use disposable local storage and cover expiry boundaries, late votes, reopening, listing permissions, browsing, filtering, and pagination.