FLASK_APP / README_HF.md
pranit144's picture
Upload 97 files
e38de99 verified

Deploying to Hugging Face Spaces

This guide explains how to host your DCRM API on Hugging Face Spaces using Docker.

Prerequisites

  1. Hugging Face Account: Sign up here.
  2. Google API Key: Required for the app to run.

Step 1: Create a Space

  1. Go to huggingface.co/new-space.
  2. Space Name: e.g., dcrm-api.
  3. License: MIT or Apache 2.0.
  4. SDK: Select Docker.
  5. Clean Template: Choose "Blank".
  6. Click Create Space.

Step 2: Push Your Code

You can push your code directly via Git:

# Initialize git if you haven't
git init

# Add the Hugging Face remote (found in your Space's "Clone repository" button)
git remote add space https://huggingface.co/spaces/YOUR_USERNAME/dcrm-api

# Push
git add .
git commit -m "Deploy to HF"
git push space main

Step 3: Configure Settings

  1. Go to your Space's Settings tab.
  2. Scroll to Variables and secrets.
  3. Click New Secret.
    • Name: GOOGLE_API_KEY
    • Value: [Your Google API Key]
  4. The Space will restart automatically.

API Usage

Your API will be available at: https://YOUR_USERNAME-dcrm-api.hf.space

Example Health Check: https://YOUR_USERNAME-dcrm-api.hf.space/api/health