Spaces:
Running
Running
Delete screenshot_setup.md
Browse files- screenshot_setup.md +0 -113
screenshot_setup.md
DELETED
|
@@ -1,113 +0,0 @@
|
|
| 1 |
-
# Screenshot Setup Guide for ChatUI Helper Documentation
|
| 2 |
-
|
| 3 |
-
This guide explains how to use Playwright to capture screenshots for the ChatUI Helper documentation.
|
| 4 |
-
|
| 5 |
-
## Installation
|
| 6 |
-
|
| 7 |
-
1. Install Playwright and its dependencies:
|
| 8 |
-
```bash
|
| 9 |
-
pip install -r requirements.txt
|
| 10 |
-
playwright install chromium
|
| 11 |
-
```
|
| 12 |
-
|
| 13 |
-
## Usage
|
| 14 |
-
|
| 15 |
-
### Capturing Local App Screenshots
|
| 16 |
-
|
| 17 |
-
1. Start the ChatUI Helper app locally:
|
| 18 |
-
```bash
|
| 19 |
-
python app.py
|
| 20 |
-
```
|
| 21 |
-
|
| 22 |
-
2. In a new terminal, run the screenshot capture:
|
| 23 |
-
```bash
|
| 24 |
-
# Capture all local app screenshots
|
| 25 |
-
python capture_docs_screenshots.py local
|
| 26 |
-
|
| 27 |
-
# Or capture all screenshots from the main script
|
| 28 |
-
python capture_screenshots.py
|
| 29 |
-
```
|
| 30 |
-
|
| 31 |
-
### Capturing HuggingFace Screenshots
|
| 32 |
-
|
| 33 |
-
For HuggingFace deployment screenshots, you can either:
|
| 34 |
-
|
| 35 |
-
1. Use placeholder URLs:
|
| 36 |
-
```bash
|
| 37 |
-
python capture_docs_screenshots.py huggingface
|
| 38 |
-
```
|
| 39 |
-
|
| 40 |
-
2. Or provide actual space details:
|
| 41 |
-
```bash
|
| 42 |
-
python capture_docs_screenshots.py huggingface your-username your-space-name
|
| 43 |
-
```
|
| 44 |
-
|
| 45 |
-
### Capturing Specific Screenshots
|
| 46 |
-
|
| 47 |
-
To capture a single screenshot:
|
| 48 |
-
```bash
|
| 49 |
-
python capture_screenshots.py main_interface
|
| 50 |
-
```
|
| 51 |
-
|
| 52 |
-
## Screenshot Configurations
|
| 53 |
-
|
| 54 |
-
### Local App Screenshots (`capture_screenshots.py`)
|
| 55 |
-
- `main_interface` - Full app interface
|
| 56 |
-
- `config_tab` - Configuration tab
|
| 57 |
-
- `template_dropdown` - Template selection
|
| 58 |
-
- `preview_tab` - Preview tab
|
| 59 |
-
- `preview_chat_example` - Chat example
|
| 60 |
-
- `docs_tab` - Documentation tab
|
| 61 |
-
- `config_system_prompt` - System configuration
|
| 62 |
-
- `config_api_section` - API configuration
|
| 63 |
-
- `generate_button` - Generate button
|
| 64 |
-
|
| 65 |
-
### Documentation Screenshots (`capture_docs_screenshots.py`)
|
| 66 |
-
- Local app documentation views
|
| 67 |
-
- HuggingFace Spaces deployment steps
|
| 68 |
-
- Settings and configuration screens
|
| 69 |
-
|
| 70 |
-
## Updating support_docs.py
|
| 71 |
-
|
| 72 |
-
After capturing new screenshots, update the image references in `support_docs.py`:
|
| 73 |
-
|
| 74 |
-
1. Replace placeholder image names (img1.png, img2.png, etc.) with descriptive names
|
| 75 |
-
2. Update the `gr.Image` components to reference the new screenshots
|
| 76 |
-
3. Ensure all image paths are correct
|
| 77 |
-
|
| 78 |
-
## Screenshot Best Practices
|
| 79 |
-
|
| 80 |
-
1. **Consistency**: Use the same viewport size (1280x800) for all screenshots
|
| 81 |
-
2. **Quality**: Device scale factor is set to 2 for high-quality images
|
| 82 |
-
3. **Wait Times**: Adjust wait times if animations haven't completed
|
| 83 |
-
4. **Headless Mode**: Set `headless=True` in the browser launch for automated captures
|
| 84 |
-
|
| 85 |
-
## Troubleshooting
|
| 86 |
-
|
| 87 |
-
### Common Issues
|
| 88 |
-
|
| 89 |
-
1. **Timeout errors**: Increase wait times in the configuration
|
| 90 |
-
2. **Element not found**: Update selectors if the UI has changed
|
| 91 |
-
3. **Network errors**: Add `wait_until='networkidle'` to page navigation
|
| 92 |
-
|
| 93 |
-
### Debug Mode
|
| 94 |
-
|
| 95 |
-
Run with visible browser:
|
| 96 |
-
```python
|
| 97 |
-
browser = await p.chromium.launch(headless=False)
|
| 98 |
-
```
|
| 99 |
-
|
| 100 |
-
### Updating Selectors
|
| 101 |
-
|
| 102 |
-
If the UI changes, update selectors in the configuration:
|
| 103 |
-
- Use browser DevTools to find new selectors
|
| 104 |
-
- Test selectors in the browser console first
|
| 105 |
-
- Use data-testid attributes when available
|
| 106 |
-
|
| 107 |
-
## Maintenance
|
| 108 |
-
|
| 109 |
-
Regularly review and update:
|
| 110 |
-
1. Screenshot configurations when UI changes
|
| 111 |
-
2. Image references in support_docs.py
|
| 112 |
-
3. Wait times if performance changes
|
| 113 |
-
4. Selectors if Gradio updates change the DOM structure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|