Blood_Cell_Object_Detection / huggingface_deployment.md
Saini16's picture
Upload 9 files
d2b859c verified

A newer version of the Streamlit SDK is available: 1.55.0

Upgrade

Hugging Face Spaces Deployment Guide

This document provides instructions on how to deploy the Blood Cell Detection application on Hugging Face Spaces.

Prerequisites

  1. A Hugging Face account
  2. The fine-tuned YOLOv10 model file
  3. This repository

Steps to Deploy

1. Create a New Space

  1. Log in to your Hugging Face account at huggingface.co
  2. Go to your profile and click on "Spaces"
  3. Click "Create new Space"
  4. Configure your Space:
    • Select "Streamlit" as the SDK
    • Set a name for your Space (e.g., "blood-cell-detection")
    • Choose visibility (Public or Private)
    • Click "Create Space"

2. Upload Files

You can upload files using the Hugging Face web interface or using Git:

Option 1: Web Interface

  1. In your new Space, click on "Files" tab
  2. Upload the following files:
    • app.py
    • model.py
    • utils.py
    • inference.py
    • The model weights file (e.g., yolov10_bccd.pt)
    • Additional Python files as needed
    • huggingface_requirements.txt (rename to requirements.txt when uploading)

Option 2: Using Git

  1. Clone the Space repository
    git clone https://huggingface.co/spaces/YOUR_USERNAME/blood-cell-detection
    
  2. Copy all project files to the cloned directory
  3. Rename huggingface_requirements.txt to requirements.txt
  4. Push to Hugging Face
    git add .
    git commit -m "Initial deployment"
    git push
    

3. Configure the Space

  1. In your Space settings, make sure:
    • The SDK is set to Streamlit
    • The Python version is at least 3.9
    • The hardware is appropriate (at least CPU)

4. Verify the Deployment

  1. Once deployed, your Space will build and start the Streamlit app
  2. Access your Space through the provided URL to verify it works correctly
  3. Test the application by uploading a blood cell image

Troubleshooting

If you encounter issues during deployment:

  1. Check the build logs in your Space
  2. Ensure the requirements.txt file includes all necessary dependencies
  3. Verify the model file path in your code matches the actual file location in the Space

Additional Resources