#!/bin/bash # ECG-FM API Deployment Script # This script helps deploy your ECG-FM API to Hugging Face Spaces echo "🚀 ECG-FM API Deployment Script" echo "================================" # Check if we're in the right directory if [ ! -f "server.py" ] || [ ! -f "Dockerfile" ] || [ ! -f "requirements.txt" ]; then echo "❌ Error: Please run this script from the ECG-FM directory containing server.py, Dockerfile, and requirements.txt" exit 1 fi echo "✅ Found all required files" echo "" # Check if git is initialized if [ ! -d ".git" ]; then echo "📁 Initializing git repository..." git init git remote add origin https://huggingface.co/spaces/mystic-cbk/ecg-fm-api echo "✅ Git repository initialized" else echo "✅ Git repository already exists" fi echo "" echo "📋 Current git status:" git status echo "" echo "🔧 Adding all files to git..." git add . echo "" echo "💾 Committing changes..." git commit -m "Update ECG-FM API deployment" echo "" echo "🚀 Pushing to Hugging Face Spaces..." git push origin main echo "" echo "✅ Deployment initiated!" echo "" echo "📊 Next steps:" echo "1. Go to: https://huggingface.co/spaces/mystic-cbk/ecg-fm-api" echo "2. Watch the build logs in the 'Build logs' tab" echo "3. Wait for build to complete (5-15 minutes)" echo "4. Test your API with: python test_client.py" echo "" echo "🌐 Your API will be available at:" echo " https://mystic-cbk-ecg-fm-api.hf.space" echo "" echo "📱 Test endpoints:" echo " - Health: https://mystic-cbk-ecg-fm-api.hf.space/healthz" echo " - Root: https://mystic-cbk-ecg-fm-api.hf.space/" echo " - Predict: POST https://mystic-cbk-ecg-fm-api.hf.space/predict"