Hugging Face Space - chunhualiao/public-docs GitHub Wiki
Here are the main steps Hugging Face Spaces follows to process the files in your repository and deploy your project online:
-
Repository Cloning
When you create or update a Space, Hugging Face clones your Git repository (from Hugging Face or GitHub) into a fresh environment. -
Environment Setup
- If your repo contains a
requirements.txt
,environment.yml
, orpackages.txt
, Hugging Face installs the listed Python and system dependencies. - For Node.js or other runtimes, it looks for files like
package.json
or custom setup scripts. - The environment is typically a Linux container with Python pre-installed.
- If your repo contains a
-
Entrypoint Detection
- Hugging Face Spaces looks for a main file to run. For Gradio or Streamlit apps, it expects
app.py
(ormain.py
). - For static sites, it looks for
index.html
. - For custom setups, you can specify the entrypoint in the Space settings.
- Hugging Face Spaces looks for a main file to run. For Gradio or Streamlit apps, it expects
-
App Launch
- The platform runs your app using the detected entrypoint (e.g.,
python app.py
for Gradio). - The app is started on a specific port (usually 7860 for Gradio), and the Space proxies web traffic to this port.
- The platform runs your app using the detected entrypoint (e.g.,
-
Live Deployment
- Once the app is running, Hugging Face exposes it at a public URL.
- Any changes you push to the repo trigger an automatic redeploy: the process repeats from step 1.
Summary of the main steps:
- Clone repo → 2. Install dependencies → 3. Detect entrypoint → 4. Launch app → 5. Serve at public URL
If you want a more detailed breakdown of any step (e.g., how dependencies are resolved, how to customize the entrypoint, or how to debug deployment issues), let me know!