Pansgpt / deploy-to-hf.sh
Ojochegbeng's picture
Upload 7 files
56f66cf verified
raw
history blame
1.72 kB
#!/bin/bash
# Deploy Qwen Embedding Model to Hugging Face Spaces
# Make sure you have the Hugging Face CLI installed and logged in
echo "πŸš€ Deploying Qwen Embedding Model to Hugging Face Spaces..."
# Check if HF CLI is installed
if ! command -v huggingface-cli &> /dev/null; then
echo "❌ Hugging Face CLI not found. Please install it first:"
echo "pip install huggingface_hub[cli]"
exit 1
fi
# Check if user is logged in
if ! huggingface-cli whoami &> /dev/null; then
echo "❌ Please log in to Hugging Face first:"
echo "huggingface-cli login"
exit 1
fi
# Get space name from user
read -p "Enter your Hugging Face username: " HF_USERNAME
read -p "Enter space name (e.g., qwen-embedding-api): " SPACE_NAME
SPACE_URL="https://huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME"
echo "πŸ“¦ Creating Hugging Face Space..."
# Create the space
huggingface-cli repo create "$SPACE_NAME" --type space --sdk docker
echo "πŸ“ Uploading files to the space..."
# Upload files to the space
huggingface-cli upload "$HF_USERNAME/$SPACE_NAME" ./Dockerfile ./Dockerfile
huggingface-cli upload "$HF_USERNAME/$SPACE_NAME" ./requirements.txt ./requirements.txt
huggingface-cli upload "$HF_USERNAME/$SPACE_NAME" ./app.py ./app.py
huggingface-cli upload "$HF_USERNAME/$SPACE_NAME" ./README.md ./README.md
echo "βœ… Deployment complete!"
echo "🌐 Your space is available at: $SPACE_URL"
echo "⏳ The space will take a few minutes to build and start."
echo ""
echo "πŸ”§ To update your PansGPT app:"
echo "1. Update the API URL in your qwen-embedding-service.ts"
echo "2. Replace the Gradio client with direct HTTP calls"
echo "3. Test the new endpoint"
echo ""
echo "πŸ“Š Monitor your space at: $SPACE_URL"