Spaces:
Running
Running
| # 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" | |