Spaces:
Runtime error
Runtime error
Download setup.ps1 from Prog-amin/pdf-qa-chatbot: direct link, hf CLI and curl.
- Browser
- Download file 3.38 kB
-
https://huggingface.co/spaces/Prog-amin/pdf-qa-chatbot/resolve/main/setup.ps1
- Command line
-
hf download hf://spaces/Prog-amin/pdf-qa-chatbot/setup.ps1
-
curl -L -o setup.ps1 https://huggingface.co/spaces/Prog-amin/pdf-qa-chatbot/resolve/main/setup.ps1
3.38 kB
| # PowerShell setup script for PDF Q&A Chatbot System | |
| Write-Host "π Setting up PDF Q&A Chatbot System..." -ForegroundColor Green | |
| # Check if Python is installed | |
| try { | |
| $pythonVersion = python --version 2>&1 | |
| Write-Host "β Python found: $pythonVersion" -ForegroundColor Green | |
| } catch { | |
| Write-Host "β Python is required but not installed. Please install Python 3.8+ and try again." -ForegroundColor Red | |
| exit 1 | |
| } | |
| # Check if Node.js is installed | |
| try { | |
| $nodeVersion = node --version 2>&1 | |
| Write-Host "β Node.js found: $nodeVersion" -ForegroundColor Green | |
| } catch { | |
| Write-Host "β Node.js is required but not installed. Please install Node.js 18+ and try again." -ForegroundColor Red | |
| exit 1 | |
| } | |
| # Check if npm is installed | |
| try { | |
| $npmVersion = npm --version 2>&1 | |
| Write-Host "β npm found: $npmVersion" -ForegroundColor Green | |
| } catch { | |
| Write-Host "β npm is required but not installed. Please install npm and try again." -ForegroundColor Red | |
| exit 1 | |
| } | |
| Write-Host "β Prerequisites check passed" -ForegroundColor Green | |
| # Backend setup | |
| Write-Host "π¦ Setting up backend..." -ForegroundColor Yellow | |
| Set-Location backend | |
| # Create virtual environment | |
| Write-Host "Creating Python virtual environment..." -ForegroundColor Yellow | |
| python -m venv venv | |
| # Activate virtual environment | |
| Write-Host "Activating virtual environment..." -ForegroundColor Yellow | |
| .\venv\Scripts\Activate.ps1 | |
| # Install dependencies | |
| Write-Host "Installing Python dependencies..." -ForegroundColor Yellow | |
| pip install -r requirements.txt | |
| # Create .env file if it doesn't exist | |
| if (-not (Test-Path .env)) { | |
| Write-Host "Creating .env file..." -ForegroundColor Yellow | |
| Copy-Item .env.example .env | |
| Write-Host "β οΈ Please edit backend/.env and add your API keys (OpenAI or Anthropic)" -ForegroundColor Yellow | |
| } | |
| Set-Location .. | |
| # Frontend setup | |
| Write-Host "π¦ Setting up frontend..." -ForegroundColor Yellow | |
| Set-Location frontend | |
| # Install dependencies | |
| Write-Host "Installing Node.js dependencies..." -ForegroundColor Yellow | |
| npm install | |
| # Create .env file if it doesn't exist | |
| if (-not (Test-Path .env)) { | |
| Write-Host "Creating .env file..." -ForegroundColor Yellow | |
| Copy-Item .env.example .env | |
| } | |
| Set-Location .. | |
| Write-Host "" | |
| Write-Host "π Setup completed successfully!" -ForegroundColor Green | |
| Write-Host "" | |
| Write-Host "π Next steps:" -ForegroundColor Cyan | |
| Write-Host "1. Edit backend/.env and add your API keys:" -ForegroundColor White | |
| Write-Host " - OPENAI_API_KEY or ANTHROPIC_API_KEY" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host "2. Start the backend server:" -ForegroundColor White | |
| Write-Host " cd backend" -ForegroundColor White | |
| Write-Host " .\venv\Scripts\Activate.ps1" -ForegroundColor White | |
| Write-Host " uvicorn main:app --reload" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host "3. Start the frontend server (in a new terminal):" -ForegroundColor White | |
| Write-Host " cd frontend" -ForegroundColor White | |
| Write-Host " npm run dev" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host "4. Open your browser and go to: http://localhost:3000" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host "π³ Alternatively, you can use Docker:" -ForegroundColor White | |
| Write-Host " docker-compose up --build" -ForegroundColor White | |
| Write-Host "" | |
| Write-Host "π For more information, see the README.md file" -ForegroundColor White |