Spaces:
Running
Running
File size: 1,724 Bytes
56f66cf |
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 |
#!/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"
|