Spaces:
Running
Running
File size: 5,282 Bytes
5f3e9f5 | 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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | # Screenshot Studio - Setup Guide
Complete guide to set up and run Screenshot Studio.
## Quick Start
```bash
# 1. Install dependencies
pip install -r requirements.txt
# 2. Install Playwright browsers
playwright install chromium
# 3. Configure API
cp config/config.example.py config/config.py
# Edit config/config.py with your API credentials
# 4. Start the application
python start.py
```
## Detailed Setup
### Step 1: System Requirements
- **Python**: 3.8 or higher
- **pip**: Latest version
- **Operating System**: Windows, macOS, or Linux
- **RAM**: Minimum 2GB
- **Disk Space**: ~500MB for dependencies
### Step 2: Install Python Dependencies
```bash
pip install -r requirements.txt
```
This installs:
- Flask (web framework)
- Playwright (screenshot engine)
- Pillow (image processing)
- Requests (HTTP client)
### Step 3: Install Playwright Browsers
Playwright needs browser binaries:
```bash
playwright install chromium
```
This downloads Chromium (~150MB). You can also install other browsers:
```bash
playwright install firefox
playwright install webkit
```
### Step 4: Configure API Settings
1. **Copy the example config:**
```bash
cp config/config.example.py config/config.py
```
2. **Edit config/config.py:**
```python
API_KEY = "your-actual-api-key"
BASE_URL = "https://your-api-endpoint.com/v1"
MODEL_NAME = "your-model-name"
```
3. **Get API credentials:**
- For Groq: https://console.groq.com/keys
- For OpenAI: https://platform.openai.com/api-keys
- For other providers: Check their documentation
### Step 5: Verify Installation
Run the startup script with checks:
```bash
python start.py
```
This will:
- ✅ Check all dependencies
- ✅ Verify configuration
- ✅ Test Playwright installation
- ✅ Create output folders
- 🚀 Start the server
### Step 6: Access the Application
Open your browser to:
```
http://localhost:5000
```
## Configuration Options
### Basic Settings (config/config.py)
```python
# API Configuration
API_KEY = "sk-..." # Your API key
BASE_URL = "https://..." # API endpoint
MODEL_NAME = "llama-3.1-70b" # Model to use
# Server Settings
DEBUG = True # Enable debug mode
PORT = 5000 # Server port
HOST = "0.0.0.0" # Listen on all interfaces
# Output Settings
DEFAULT_SCREENSHOT_FOLDER = "output/screenshots"
DEFAULT_HTML_FOLDER = "output/html"
```
### Advanced Settings
```python
# Screenshot Quality
DEFAULT_VIEWPORT_WIDTH = 1920 # Screenshot width
DEFAULT_VIEWPORT_HEIGHT = 1080 # Screenshot height
DEFAULT_DEVICE_SCALE = 2.5 # Quality multiplier
DEFAULT_FONT_SIZE = 250 # Font size percentage
DEFAULT_OVERLAP = 35 # Overlap between shots
# Limits
MAX_SCREENSHOTS_LIMIT = 50 # Maximum screenshots per request
MAX_TOKENS = 100000 # Maximum AI tokens
```
## Troubleshooting
### Issue: "Module not found"
**Solution:**
```bash
pip install -r requirements.txt
```
### Issue: "Playwright executable not found"
**Solution:**
```bash
playwright install chromium
```
### Issue: "API key invalid"
**Solution:**
1. Check `config/config.py` has correct API key
2. Verify API key is active on provider's dashboard
3. Check BASE_URL is correct
### Issue: "Permission denied" on output folders
**Solution:**
```bash
# Windows
icacls output /grant Users:F /T
# Linux/Mac
chmod -R 755 output
```
### Issue: Port 5000 already in use
**Solution:**
Edit `config/config.py`:
```python
PORT = 5001 # Use different port
```
Or stop the process using port 5000:
```bash
# Windows
netstat -ano | findstr :5000
taskkill /PID <PID> /F
# Linux/Mac
lsof -ti:5000 | xargs kill -9
```
## Running in Production
### Using Gunicorn (Linux/Mac)
```bash
gunicorn -w 4 -b 0.0.0.0:5000 app:app
```
### Using Waitress (Windows)
```bash
pip install waitress
waitress-serve --port=5000 app:app
```
### Environment Variables
Set sensitive data via environment variables:
```bash
# Linux/Mac
export API_KEY="your-key"
export BASE_URL="your-url"
# Windows
set API_KEY=your-key
set BASE_URL=your-url
```
Then in `config/config.py`:
```python
import os
API_KEY = os.getenv('API_KEY', 'default-key')
BASE_URL = os.getenv('BASE_URL', 'default-url')
```
## Updating
### Update Python packages
```bash
pip install --upgrade -r requirements.txt
```
### Update Playwright
```bash
playwright install chromium --force
```
## Uninstalling
```bash
# Remove Python packages
pip uninstall -r requirements.txt -y
# Remove Playwright browsers
playwright uninstall --all
# Delete project folder
cd ..
rm -rf screenshot-studio
```
## Getting Help
1. **Check terminal output** for detailed error messages
2. **Review logs** in the console
3. **Verify configuration** in `config/config.py`
4. **Test API** separately to isolate issues
## Next Steps
After setup:
1. Read [README.md](README.md) for usage instructions
2. Check [static/README.md](static/README.md) for frontend customization
3. Explore the UI at http://localhost:5000
4. Try the Text to Image tool with sample content
5. Experiment with advanced settings
## Support
For issues:
- Check error messages in terminal
- Verify all setup steps completed
- Review troubleshooting section
- Check API provider status
|