Spaces:
Running
Running
File size: 2,899 Bytes
fa85a62 |
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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
#!/bin/bash
# Setup script for pushing Reddit Scraper to Hugging Face
echo "==== Reddit Scraper: Hugging Face Setup ===="
echo ""
# Check for required tools
echo "Checking for required tools..."
if ! command -v git &> /dev/null; then
echo "β Git not found. Please install Git before continuing."
exit 1
else
echo "β
Git installed"
fi
if ! command -v python3 &> /dev/null; then
echo "β Python 3 not found. Please install Python 3 before continuing."
exit 1
else
echo "β
Python 3 installed"
fi
if ! command -v pip3 &> /dev/null; then
echo "β pip not found. Please install pip before continuing."
exit 1
else
echo "β
pip installed"
fi
if ! command -v huggingface-cli &> /dev/null; then
echo "β οΈ Hugging Face CLI not installed. Installing now..."
pip install huggingface_hub
if ! command -v huggingface-cli &> /dev/null; then
echo "β Failed to install Hugging Face CLI. Please install manually: pip install huggingface_hub"
exit 1
else
echo "β
Hugging Face CLI installed"
fi
else
echo "β
Hugging Face CLI installed"
fi
echo ""
echo "Verifying project files..."
# Check for required files
required_files=("app.py" "requirements.txt" "enhanced_scraper.py" "advanced_scraper_ui.py" "README-HF.md")
missing_files=0
for file in "${required_files[@]}"; do
if [ ! -f "$file" ]; then
echo "β Missing required file: $file"
missing_files=$((missing_files+1))
else
echo "β
Found $file"
fi
done
if [ $missing_files -gt 0 ]; then
echo ""
echo "β Some required files are missing. Please make sure all project files exist."
exit 1
fi
echo ""
echo "All required files are present."
echo ""
# Check for Hugging Face login
echo "Checking Hugging Face login status..."
huggingface-cli whoami &> /dev/null
if [ $? -ne 0 ]; then
echo "You need to login to Hugging Face first."
echo "Run the following command and follow the instructions:"
echo ""
echo "huggingface-cli login"
echo ""
exit 1
else
echo "β
Already logged in to Hugging Face"
fi
echo ""
echo "==== Ready to push to Hugging Face! ===="
echo ""
echo "To create a new Hugging Face Space and push your code:"
echo ""
echo "1. Go to https://huggingface.co/new-space"
echo "2. Choose a Space name (e.g., 'reddit-scraper')"
echo "3. Select 'Streamlit' as the SDK"
echo "4. Create the Space"
echo ""
echo "Then run the following commands to push your code:"
echo ""
echo "git init"
echo "git add ."
echo "git commit -m \"Initial commit of Reddit Scraper\""
echo "git branch -M main"
echo "git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/reddit-scraper"
echo "git push -u origin main"
echo ""
echo "Replace YOUR_USERNAME with your Hugging Face username."
echo ""
echo "Remember to set up your Reddit API credentials in the Space settings!"
echo ""
|