File size: 1,677 Bytes
91e999e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash

# This script helps deploy your application to Hugging Face Spaces

# Set your Hugging Face username and space name
read -p "Enter your Hugging Face username: " HF_USERNAME
read -p "Enter your Space name (e.g., swahili-content-generation): " SPACE_NAME

# Check if git is installed
if ! command -v git &> /dev/null; then
    echo "Git is not installed. Please install git and try again."
    exit 1
fi

# Check if git-lfs is installed
if ! command -v git-lfs &> /dev/null; then
    echo "Git LFS is not installed. Please install git-lfs and try again."
    echo "Visit https://git-lfs.github.com/ for installation instructions."
    exit 1
fi

# Check if the repository exists
if [ ! -d ".git" ]; then
    echo "Initializing git repository..."
    git init
    git lfs install
fi

# Set up Git LFS tracking for large files
echo "Setting up Git LFS for large files..."
git lfs track "data/pdfs/*.pdf"
git lfs track "data/index/*.index"
git add .gitattributes

# Rename Dockerfile.spaces to Dockerfile for Hugging Face Spaces
cp Dockerfile.spaces Dockerfile

# Add all files to git
git add .

# Commit changes
git commit -m "Prepare for Hugging Face Spaces deployment"

# Add Hugging Face Spaces as a remote
git remote add space https://huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME || git remote set-url space https://huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME

# Push to Hugging Face Spaces
echo "Pushing to Hugging Face Spaces..."
git push --force space main

echo "Deployment complete! Your application should be available at: https://huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME"
echo "Note: It may take a few minutes for the Space to build and deploy."