Spaces:
Running
Running
# Setup git repository for Hugging Face Spaces | |
# Check if HF_TOKEN environment variable is set | |
if [ -z "$HF_TOKEN" ]; then | |
echo "Error: HF_TOKEN environment variable is not set." | |
echo "Please set it first with: export HF_TOKEN=your_hugging_face_token" | |
exit 1 | |
fi | |
# Get your username | |
echo "Enter your Hugging Face username:" | |
read HF_USERNAME | |
# Get the space name | |
echo "Enter the name for your Hugging Face Space (e.g., historical-ocr):" | |
read HF_SPACE | |
# Prepare the files for deployment | |
echo "Preparing files for deployment..." | |
python3 prepare_for_hf.py | |
# Initialize git | |
git init | |
git add . | |
git commit -m "Initial commit" | |
# Create the repository on Hugging Face | |
echo "Creating and pushing to Hugging Face Space..." | |
git remote add origin https://huggingface.co/spaces/$HF_USERNAME/$HF_SPACE | |
huggingface-cli login --token $HF_TOKEN | |
git push -u origin main | |
echo "Deployment completed! Your app should be available at:" | |
echo "https://huggingface.co/spaces/$HF_USERNAME/$HF_SPACE" |