Spaces:
Runtime error
Runtime error
Download setup.sh from Prog-amin/pdf-qa-chatbot: direct link, hf CLI and curl.
- Browser
- Download file 2.24 kB
-
https://huggingface.co/spaces/Prog-amin/pdf-qa-chatbot/resolve/main/setup.sh
- Command line
-
hf download hf://spaces/Prog-amin/pdf-qa-chatbot/setup.sh
-
curl -L -o setup.sh https://huggingface.co/spaces/Prog-amin/pdf-qa-chatbot/resolve/main/setup.sh
2.24 kB
| echo "π Setting up PDF Q&A Chatbot System..." | |
| # Check if Python is installed | |
| if ! command -v python3 &> /dev/null; then | |
| echo "β Python 3 is required but not installed. Please install Python 3.8+ and try again." | |
| exit 1 | |
| fi | |
| # Check if Node.js is installed | |
| if ! command -v node &> /dev/null; then | |
| echo "β Node.js is required but not installed. Please install Node.js 18+ and try again." | |
| exit 1 | |
| fi | |
| # Check if npm is installed | |
| if ! command -v npm &> /dev/null; then | |
| echo "β npm is required but not installed. Please install npm and try again." | |
| exit 1 | |
| fi | |
| echo "β Prerequisites check passed" | |
| # Backend setup | |
| echo "π¦ Setting up backend..." | |
| cd backend | |
| # Create virtual environment | |
| echo "Creating Python virtual environment..." | |
| python3 -m venv venv | |
| # Activate virtual environment | |
| if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then | |
| source venv/Scripts/activate | |
| else | |
| source venv/bin/activate | |
| fi | |
| # Install dependencies | |
| echo "Installing Python dependencies..." | |
| pip install -r requirements.txt | |
| # Create .env file if it doesn't exist | |
| if [ ! -f .env ]; then | |
| echo "Creating .env file..." | |
| cp .env.example .env | |
| echo "β οΈ Please edit backend/.env and add your API keys (OpenAI or Anthropic)" | |
| fi | |
| cd .. | |
| # Frontend setup | |
| echo "π¦ Setting up frontend..." | |
| cd frontend | |
| # Install dependencies | |
| echo "Installing Node.js dependencies..." | |
| npm install | |
| # Create .env file if it doesn't exist | |
| if [ ! -f .env ]; then | |
| echo "Creating .env file..." | |
| cp .env.example .env | |
| fi | |
| cd .. | |
| echo "" | |
| echo "π Setup completed successfully!" | |
| echo "" | |
| echo "π Next steps:" | |
| echo "1. Edit backend/.env and add your API keys:" | |
| echo " - OPENAI_API_KEY or ANTHROPIC_API_KEY" | |
| echo "" | |
| echo "2. Start the backend server:" | |
| echo " cd backend" | |
| echo " source venv/bin/activate # On Windows: venv\\Scripts\\activate" | |
| echo " uvicorn main:app --reload" | |
| echo "" | |
| echo "3. Start the frontend server (in a new terminal):" | |
| echo " cd frontend" | |
| echo " npm run dev" | |
| echo "" | |
| echo "4. Open your browser and go to: http://localhost:3000" | |
| echo "" | |
| echo "π³ Alternatively, you can use Docker:" | |
| echo " docker-compose up --build" | |
| echo "" | |
| echo "π For more information, see the README.md file" |