Skip to content

Commit f6f82d5

Browse files
saifm-aiblaise-muhirwamjvogelsong
authored
Small fixes and typos to some code blocks (#137)
* Small fixes and typos to some code blocks * Accept suggested change Co-authored-by: Michael Vogelsong <[email protected]> --------- Co-authored-by: blaise-muhirwa <[email protected]> Co-authored-by: Michael Vogelsong <[email protected]>
1 parent a1eb551 commit f6f82d5

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

docs/docs/getting-started/4-dog-on-couch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def play_sound(file_path):
7979
```python notest
8080
gl = Groundlight()
8181

82-
detector = gl.get_detector("Dog on Couch Detector")
82+
detector = gl.get_or_create_detector("Dog on Couch Detector")
8383

8484
while True:
8585
image = capture_image()

docs/docs/getting-started/5-streaming.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ A quick example to get used to setting up detectors and asking good questions: s
1212
Ensure you have Python 3.7 or higher installed, and then install the Groundlight SDK and OpenCV library:
1313

1414
```bash
15+
# MacOS
16+
brew install ffmpeg
17+
18+
# Ubuntu/Fedora linux
19+
sudo apt install -y ffmpeg
20+
1521
pip install groundlight pillow ffmpeg yt-dlp typer
1622
```
1723

@@ -27,9 +33,15 @@ ffmpeg -i "$(yt-dlp -g $1 | head -n 1)" -vframes 1 last.jpg -y
2733

2834
This will download the most recent frame from a YouTube live stream and save it to a local file `last.jpg`.
2935

30-
2. Log in to the [Groundlight application](https://app.groundlight.ai) and get an [API Token](api-tokens).
36+
2. Ensure that the script has execute permissions. You can add execute permissions using the following command:
37+
38+
```
39+
chmod +x get_latest_frame.sh
40+
```
41+
42+
3. Log in to the [Groundlight application](https://app.groundlight.ai) and get an [API Token](api-tokens).
3143

32-
3. Next, we'll write the Python script for the application.
44+
4. Next, we'll write the Python script for the application.
3345

3446
```python notest
3547
import os
@@ -47,7 +59,7 @@ def main(*, video_id: str = None, detector_name: str = None, query: str = None,
4759
:param query: Question you want to ask of the stream (we will alert on the answer of NO)
4860
"""
4961
gl = Groundlight()
50-
detector = gl.create_detector(name=detector_name, query=query, confidence_threshold=confidence)
62+
detector = gl.get_or_create_detector(name=detector_name, query=query, confidence_threshold=confidence)
5163

5264
while True:
5365
p = subprocess.run(["./get_latest_frame.sh", video_id])
@@ -66,9 +78,9 @@ if __name__ == "__main__":
6678

6779
```
6880

69-
4. Save the script as `streaming_alert.py` in the same directory as `get_latest_frame.sh` above and run it:
81+
5. Save the script as `streaming_alert.py` in the same directory as `get_latest_frame.sh` above and run it:
7082

7183
```bash
72-
python streaming_alert.py <VIDEO_ID> --detector_name <DETECTOR_NAME> --query <QUERY IN QUOTATION MARKS>
84+
python streaming_alert.py --video-id=<VIDEO_ID> --detector-name=<DETECTOR_NAME> --query=<QUERY IN QUOTATION MARKS>
7385
```
7486

0 commit comments

Comments
 (0)