Create install.md
Browse files- install.md +106 -0
install.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GPT-4o Media Stream Capture and Analysis
|
| 2 |
+
|
| 3 |
+
## Project Overview
|
| 4 |
+
|
| 5 |
+
This project provides a web application that captures media streams from various sources such as a webcam, desktop, or specific applications. It captures frames at intervals and uses AI to analyze and summarize the frames, providing insights using GPT-4.
|
| 6 |
+
|
| 7 |
+

|
| 8 |
+
|
| 9 |
+
### Key Features
|
| 10 |
+
|
| 11 |
+
- **Media Stream Capture**: Capture video streams from a webcam, screen, or specific applications.
|
| 12 |
+
- **Frame Analysis**: Use OpenAI's GPT-4 to analyze captured frames for text, objects, context, and other details.
|
| 13 |
+
- **Customizable Prompts**: Customize the prompt used for frame analysis.
|
| 14 |
+
- **API Integration**: Integrate with OpenAI's API for frame analysis.
|
| 15 |
+
|
| 16 |
+
## Project Structure
|
| 17 |
+
|
| 18 |
+
- `app.py`: The main server-side application code using Quart.
|
| 19 |
+
- `templates/index.html`: The HTML template for the web application.
|
| 20 |
+
- `static/script.js`: The client-side JavaScript for handling media streams and interaction with the backend.
|
| 21 |
+
|
| 22 |
+
## API Endpoints
|
| 23 |
+
|
| 24 |
+
- **`GET /`**: Serves the main web application.
|
| 25 |
+
- **`POST /process_frame`**: Processes a captured frame and returns the analysis result.
|
| 26 |
+
|
| 27 |
+
### `POST /process_frame`
|
| 28 |
+
- **Request Body**:
|
| 29 |
+
```json
|
| 30 |
+
{
|
| 31 |
+
"image": "data:image/jpeg;base64,<base64-encoded-image>",
|
| 32 |
+
"prompt": "Analyze this frame",
|
| 33 |
+
"api_key": "<OpenAI API Key>"
|
| 34 |
+
}
|
| 35 |
+
```
|
| 36 |
+
- **Response**:
|
| 37 |
+
```json
|
| 38 |
+
{
|
| 39 |
+
"response": "<Analysis result in markdown format>"
|
| 40 |
+
}
|
| 41 |
+
```
|
| 42 |
+
|
| 43 |
+
## Potential Uses
|
| 44 |
+
|
| 45 |
+
- **Remote Monitoring**: Capture and analyze video streams for remote monitoring applications.
|
| 46 |
+
- **Educational Purposes**: Use AI to analyze and summarize educational video content.
|
| 47 |
+
- **Content Creation**: Automate the analysis and summarization of video content for creators.
|
| 48 |
+
|
| 49 |
+
## Customization
|
| 50 |
+
|
| 51 |
+
- **Prompts**: Customize the analysis prompt via the settings panel in the web application.
|
| 52 |
+
- **Refresh Rate**: Adjust the frame capture interval through the settings panel.
|
| 53 |
+
- **API Key**: Configure the OpenAI API key via the settings panel.
|
| 54 |
+
|
| 55 |
+
## Deployment
|
| 56 |
+
|
| 57 |
+
1. **Clone the Repository**:
|
| 58 |
+
```bash
|
| 59 |
+
git clone https://github.com/ruvnet/ai-video.git
|
| 60 |
+
cd ai-video
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
2. **Install Dependencies**:
|
| 64 |
+
```bash
|
| 65 |
+
pip install -r requirements.txt
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
3. **Set Environment Variables**:
|
| 69 |
+
```bash
|
| 70 |
+
export OPENAI_API_KEY=<your_openai_api_key>
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
4. **Run the Application**:
|
| 74 |
+
```bash
|
| 75 |
+
python app.py
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
5. **Access the Application**:
|
| 79 |
+
Open your web browser and navigate to `http://localhost:5000`.
|
| 80 |
+
|
| 81 |
+
## `requirements.txt`
|
| 82 |
+
```plaintext
|
| 83 |
+
quart
|
| 84 |
+
opencv-python-headless
|
| 85 |
+
httpx
|
| 86 |
+
numpy
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
### API Endpoints
|
| 90 |
+
|
| 91 |
+
- **`GET /`**: Serves the main web application.
|
| 92 |
+
- **`POST /process_frame`**: Processes a captured frame and returns the analysis result.
|
| 93 |
+
|
| 94 |
+
### Customization
|
| 95 |
+
|
| 96 |
+
- Customize prompts and refresh rates via the settings panel in the web application.
|
| 97 |
+
- Configure the OpenAI API key via the settings panel.
|
| 98 |
+
|
| 99 |
+
## Contributing
|
| 100 |
+
|
| 101 |
+
Feel free to fork the repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
|
| 102 |
+
|
| 103 |
+
## License
|
| 104 |
+
|
| 105 |
+
[MIT](LICENSE)
|
| 106 |
+
|