PRISM2.0 / .agent /workflows /deploy_to_huggingface.md
devranx's picture
Initial deploy with LFS images and audio
d790e98
metadata
description: Deploy to Hugging Face Spaces

Deploying to Hugging Face Spaces

This guide explains how to deploy the Samsung Prism Prototype to a Hugging Face Space and keep it synced with your local changes.

Prerequisites

  1. A Hugging Face account.
  2. Git installed on your machine.

Step 1: Create a New Space

  1. Go to huggingface.co/spaces.
  2. Click "Create new Space".
  3. Name: samsung-prism-prototype (or similar).
  4. License: MIT (optional).
  5. SDK: Select Docker (Recommended for custom dependencies like OpenCV/EasyOCR) or Gradio (if you were using Gradio, but we are using Flask, so Docker is best).
    • Note: Since we are using Flask, Docker is the most flexible option. Select Docker -> Blank.
  6. Click "Create Space".

Step 2: Prepare Your Project for Docker

Ensure you have a Dockerfile in the root of your project. (I will verify/create this for you in the next steps).

Step 3: Connect Local Repo to Hugging Face

  1. Initialize git if you haven't already:
    git init
    
  2. Add the Hugging Face remote (replace YOUR_USERNAME and SPACE_NAME):
    git remote add space https://huggingface.co/spaces/YOUR_USERNAME/SPACE_NAME
    
  3. Pull the initial files (like README.md) from the Space:
    git pull space main --allow-unrelated-histories
    

Step 4: Push Changes

Whenever you make changes locally, run these commands to update the Space:

# Add all changes
git add .

# Commit changes
git commit -m "Update prototype"

# Push to Hugging Face
git push space main

Step 5: Handling Large Files (Models)

IMPORTANT: Hugging Face Spaces have a hard limit on file sizes for Git (LFS). Since your Models/ directory is large, you should NOT push it to Git directly if the files are huge. Instead, rely on the model_handler.py logic to download models from the Hugging Face Hub at runtime, or use git lfs if you must upload custom weights.

Since we updated model_handler.py to download from HF Hub if local files are missing, you can simply exclude the Models/ directory from git.

Create/Update .gitignore:

Models/
__pycache__/
.venv/
.env