Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Jatin-Mehra119/PDF-Insight-Beta/llms.txt

Use this file to discover all available pages before exploring further.

PDF Insight Pro ships with a ready-to-use GitHub Actions CI/CD pipeline defined in .github/workflows/sync_to_hf.yml. Every time a commit is pushed to the main branch, the workflow checks out the full git history, swaps in the HF-specific README_hf.md as the Space card, and force-pushes the repository to your Hugging Face Space. Hugging Face then picks up the Dockerfile at the repo root and builds the container automatically.

Prerequisites

  • A Hugging Face account
  • A Hugging Face Space created with the Docker SDK
  • A Hugging Face access token with write permission to the Space
  • A fork of the PDF Insight Pro GitHub repository

Setup

1

Fork the repository

Click Fork on the PDF-Insight-Beta GitHub page to create your own copy. All subsequent steps apply to your fork.
2

Create a Hugging Face Space

  1. Go to huggingface.co/new-space.
  2. Choose a space name (e.g., PDF-Insight-PRO).
  3. Select Docker as the Space SDK.
  4. Set visibility to Public or Private as required.
  5. Click Create Space — an empty Space is created and ready to receive pushes.
3

Add HF_TOKEN as a GitHub Actions secret

  1. In your forked GitHub repository, navigate to Settings → Secrets and variables → Actions.
  2. Click New repository secret.
  3. Name it HF_TOKEN and paste your Hugging Face access token as the value.
  4. Click Add secret.
The workflow reads this secret as ${{ secrets.HF_TOKEN }} to authenticate the git push to Hugging Face.
4

Add API keys as Hugging Face Space secrets

API keys must be injected at Docker build time by Hugging Face. Add them in the Space settings — not in the GitHub repository.
  1. Open your Space on Hugging Face.
  2. Go to Settings → Variables and secrets.
  3. Add two secrets:
    • GROQ_API_KEY — your Groq API key
    • TAVILY_API_KEY — your Tavily API key
Hugging Face will mount these as Docker build secrets, matching the --mount=type=secret instructions in the Dockerfile.
5

Update the workflow with your username and space name

Open .github/workflows/sync_to_hf.yml in your fork and update the two hardcoded environment variables to match your Hugging Face account:
env:
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
  HF_USERNAME: your-hf-username      # ← replace jatinmehra
  HF_SPACE: your-space-name          # ← replace PDF-Insight-PRO
Commit and push this change to main.
6

Push to main to trigger deployment

Any push to the main branch now triggers the workflow automatically.Monitor the Space build logs at:
https://huggingface.co/spaces/<your-username>/<your-space-name>/logs
Once the Docker build completes the Space URL becomes live and accessible.

Workflow File

The full workflow is shown below for reference.
name: Sync to Hugging Face Space

on:
  push:
    branches:
      - main

permissions:
  contents: write

jobs:
  sync-to-space:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Prepare Hugging Face README
        run: |
          # Temporarily replace README.md for Hugging Face
          mv README_hf.md README.md

      - name: Push to Hugging Face Space
        env:
          HF_TOKEN: ${{ secrets.HF_TOKEN }}
          HF_USERNAME: jatinmehra
          HF_SPACE: PDF-Insight-PRO
        run: |
          git config --global user.email "github-actions[bot]@users.noreply.github.com"
          git config --global user.name "github-actions[bot]"
          git remote remove origin || true
          git remote add origin "https://${HF_USERNAME}:${HF_TOKEN}@huggingface.co/spaces/${HF_USERNAME}/${HF_SPACE}"
          git add README.md
          git commit -m "Update Hugging Face README" || true
          git push origin main || (git branch -M main && git push -f origin main)

Space Configuration

Port mapping

The Dockerfile exposes port 7860 and Uvicorn binds to 0.0.0.0:7860. Hugging Face Spaces automatically maps this container port to the public HTTPS URL of your Space — no additional port configuration is required.

Secrets management

SecretWhere to set itPurpose
HF_TOKENGitHub repository → Actions secretsAuthenticates the git push from the workflow to Hugging Face
GROQ_API_KEYHF Space → Variables and secretsInjected as a Docker build secret for the LLM backend
TAVILY_API_KEYHF Space → Variables and secretsInjected as a Docker build secret for web search integration
The repository contains a README_hf.md file alongside the standard README.md. README_hf.md holds the Hugging Face Space card YAML front-matter (title, emoji, colorFrom, colorTo, sdk, app_port, license, etc.). The workflow swaps it in as README.md before pushing so that Hugging Face renders the correct Space card metadata without polluting the GitHub repository’s main README.
If your Space gets stuck in a Building state, open the Logs tab in your Space settings and look for Docker build errors. Common issues include a missing GROQ_API_KEY or TAVILY_API_KEY secret (the Dockerfile marks both as required=true) and Python package installation failures. Fixing the secret values and triggering a new push will restart the build automatically.

Build docs developers (and LLMs) love