rajthakkar123 commited on
Commit
8cb0b9d
Β·
verified Β·
1 Parent(s): 11f68f4

Update APPLICATION_README.md

Browse files
Files changed (1) hide show
  1. APPLICATION_README.md +109 -56
APPLICATION_README.md CHANGED
@@ -1,70 +1,123 @@
1
- # Chrome Controller for Hugging Face Spaces
2
-
3
- A Gradio-based interface to control a headless Chrome browser instance with persistent profile storage.
4
-
5
- ## Configuration
6
-
7
- This space is configured to use:
8
-
9
- - **SDK**: gradio
10
- - **SDK Version**: 4.43.0 (stable version)
11
- - **Hardware**: CPU Basic (sufficient for Chrome operations)
12
-
13
- ## Files Structure
14
-
15
- ```
16
- /
17
- β”œβ”€β”€ app.py # Main application
18
- β”œβ”€β”€ requirements.txt # Python dependencies
19
- β”œβ”€β”€ Dockerfile # Container configuration
20
- └── README.md # This file
21
- ```
22
-
23
- ## Key Features
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- 1. **Persistent Chrome Profile**: Stored in `/app/chrome_profile`
26
- 2. **Headless Chrome**: Optimized for containerized environments
27
- 3. **Screenshot Capture**: Take screenshots of web pages
28
- 4. **URL Navigation**: Navigate to any website
29
- 5. **Process Management**: Safe Chrome process handling
30
 
31
- ## Usage
32
 
33
- 1. Click "πŸš€ Start Chrome" to launch the browser
34
- 2. Use "🧭 Navigate" to go to specific URLs
35
- 3. Click "πŸ“Έ Take Screenshot" to capture the current page
36
- 4. Use "πŸ›‘ Stop Chrome" to terminate all processes
37
 
38
- ## Technical Details
 
 
 
39
 
40
- - Chrome runs in headless mode with remote debugging enabled
41
- - Uses Selenium WebDriver for automation
42
- - Optimized Chrome flags for containerized environments
43
- - Proper error handling and resource cleanup
44
 
45
- ## Troubleshooting
 
 
 
46
 
47
- If you encounter issues:
48
 
49
- 1. **Chrome won't start**: Check the status output for error messages
50
- 2. **Screenshots fail**: Ensure Chrome is running first
51
- 3. **Navigation issues**: Verify the URL format (add https:// if needed)
 
52
 
53
- ## Dependencies
54
 
55
- - `gradio==4.43.0` - Web interface framework
56
- - `selenium==4.25.0` - Browser automation
57
- - `webdriver-manager==4.0.2` - ChromeDriver management
58
- - `psutil==6.0.0` - Process management
59
- - `Pillow==10.4.0` - Image processing
60
 
61
- ## Limitations
62
 
63
- - Chrome profile persists only during the session
64
- - Limited to headless browser operations
65
- - No audio/video playback in headless mode
66
- - CPU-based processing only
67
 
68
- ## Support
69
 
70
- For issues or improvements, please check the Hugging Face Spaces documentation or create a discussion in the Space.
 
1
+ ---
2
+ title: Chrome Controller Pro
3
+ emoji: 🌐
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: docker
7
+ pinned: false
8
+ license: mit
9
+ app_port: 7860
10
+ ---
11
+
12
+ # Chrome Controller Pro
13
+
14
+ A professional-grade Chrome browser controller for Hugging Face Spaces with advanced automation capabilities.
15
+
16
+ ## πŸš€ Features
17
+
18
+ - **Headless Chrome Management**: Start, stop, and monitor Chrome instances
19
+ - **Screenshot Capture**: Take high-quality screenshots of web pages
20
+ - **URL Navigation**: Navigate to any website with automatic protocol handling
21
+ - **JavaScript Execution**: Execute custom JavaScript code in the browser context
22
+ - **Process Management**: Robust Chrome process lifecycle management
23
+ - **Persistent Profiles**: Chrome user data persistence during session
24
+
25
+ ## πŸ› οΈ Key Improvements Over Previous Version
26
+
27
+ ### Fixed Issues:
28
+ 1. **Gradio Schema Error**: Resolved `TypeError: argument of type 'bool' is not iterable` by using proper Gradio component initialization
29
+ 2. **Launch Configuration**: Fixed localhost accessibility issues with proper server configuration
30
+ 3. **Chrome Stability**: Enhanced Chrome startup reliability with better error handling
31
+ 4. **Resource Management**: Improved process cleanup and memory management
32
+
33
+ ### New Features:
34
+ 1. **JavaScript Console**: Execute custom JavaScript code directly in the browser
35
+ 2. **Tabbed Interface**: Organized functionality into logical tabs
36
+ 3. **Enhanced Status Monitoring**: Real-time Chrome process status updates
37
+ 4. **Better Error Handling**: Comprehensive error messages and recovery options
38
+ 5. **Optimized Performance**: Reduced startup time and improved responsiveness
39
+
40
+ ## πŸ—οΈ Architecture
41
+
42
+ The application uses a class-based architecture with the `ChromeController` class managing:
43
+ - Chrome process lifecycle
44
+ - WebDriver connections
45
+ - Screenshot capture
46
+ - JavaScript execution
47
+ - Process monitoring
48
+
49
+ ## 🐳 Docker Configuration
50
+
51
+ The Dockerfile is optimized for:
52
+ - Minimal image size with multi-stage optimization
53
+ - Proper Chrome dependencies installation
54
+ - Security best practices with non-root user
55
+ - Health checks for reliability
56
+
57
+ ## πŸ“‹ Usage Instructions
58
+
59
+ 1. **Start Chrome**: Click "πŸš€ Start Chrome" to launch the browser instance
60
+ 2. **Navigate**: Enter a URL and click "🧭 Navigate" to visit websites
61
+ 3. **Screenshot**: Use "πŸ“Έ Take Screenshot" to capture the current page
62
+ 4. **Execute JS**: Use the JavaScript tab to run custom code
63
+ 5. **Monitor**: Check status and manage processes as needed
64
+
65
+ ## πŸ”§ Technical Details
66
+
67
+ ### Chrome Arguments
68
+ Optimized Chrome flags for containerized environments:
69
+ - Headless mode with new engine
70
+ - Disabled GPU acceleration for CPU environments
71
+ - Security sandbox disabled for container compatibility
72
+ - Remote debugging enabled on port 9222
73
+ - Crash reporting disabled to prevent permission issues
74
+
75
+ ### Dependencies
76
+ - `gradio==4.44.0` - Web interface framework
77
+ - `selenium==4.25.0` - Browser automation
78
+ - `webdriver-manager==4.0.2` - ChromeDriver management
79
+ - `psutil==6.0.0` - Process management
80
+ - `Pillow==10.4.0` - Image processing
81
 
82
+ ## 🚨 Troubleshooting
 
 
 
 
83
 
84
+ ### Common Issues:
85
 
86
+ 1. **Chrome won't start**
87
+ - Check the status output for specific error messages
88
+ - Ensure sufficient memory is available
89
+ - Try stopping and restarting Chrome
90
 
91
+ 2. **Screenshots fail**
92
+ - Verify Chrome is running with "πŸ“Š Check Status"
93
+ - Ensure the page has finished loading
94
+ - Check if the target URL is accessible
95
 
96
+ 3. **JavaScript execution errors**
97
+ - Verify the JavaScript syntax
98
+ - Ensure Chrome is running and has a page loaded
99
+ - Check browser console for additional error details
100
 
101
+ ### Performance Tips:
102
+ - Keep Chrome running between operations for better performance
103
+ - Use the status check before taking screenshots
104
+ - Clean up processes periodically if running long sessions
105
 
106
+ ## πŸ”’ Security Notes
107
 
108
+ - Runs in a sandboxed container environment
109
+ - Uses non-root user for enhanced security
110
+ - Chrome security features are partially disabled for container compatibility
111
+ - No persistent data storage outside the session
112
 
113
+ ## πŸ“ License
114
 
115
+ MIT License - Feel free to use and modify as needed.
 
 
 
 
116
 
117
+ ## 🀝 Contributing
118
 
119
+ This is an open-source project. Contributions, issues, and feature requests are welcome!
 
 
 
120
 
121
+ ---
122
 
123
+ *Built with ❀️ for the Hugging Face Spaces community*