metadata
title: Pinger
emoji: 🔄
colorFrom: green
colorTo: blue
sdk: docker
app_port: 7860
HuggingFace Spaces Pinger
A simple service that pings your HuggingFace Spaces to prevent them from going to sleep after 24 hours of inactivity.
Features
- Pings configured HuggingFace Spaces at regular intervals
- Simple status dashboard at
/ - Health check endpoint at
/health - Configurable ping interval
Setup
Environment Variables
| Variable | Description | Default |
|---|---|---|
SPACES_URLS |
Comma-separated list of HF Space URLs to ping | (required) |
PING_INTERVAL_SECONDS |
Seconds between each ping cycle | 3600 |
HF_TOKEN |
HuggingFace token for private spaces | (optional) |
Example
export SPACES_URLS="https://user-name-space1.hf.space,https://user-name-space2.hf.space"
python main.py
Deploy to HuggingFace Spaces
- Create a new Space on HuggingFace
- Select Docker as the SDK
- Clone your space repo
- Copy these files:
main.pyrequirements.txtDockerfile
- Add the
SPACES_URLSenvironment variable in your Space settings - Push and wait for deployment
Local Development
pip install -r requirements.txt
export SPACES_URLS="https://xxx.hf.space,https://yyy.hf.space"
python main.py
Endpoints
GET /- Status dashboard showing all spaces and last ping resultsGET /health- Health check (returns{"status": "healthy"})