Skip to content

Commit

Permalink
Merge branch 'main' into add_label_posts_review_reason
Browse files Browse the repository at this point in the history
  • Loading branch information
sunildkumar committed Dec 6, 2023
2 parents 66ac186 + f6f82d5 commit 0885b2b
Show file tree
Hide file tree
Showing 5 changed files with 5,867 additions and 3,461 deletions.
2 changes: 1 addition & 1 deletion docs/docs/getting-started/4-dog-on-couch.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def play_sound(file_path):
```python notest
gl = Groundlight()

detector = gl.get_detector("Dog on Couch Detector")
detector = gl.get_or_create_detector("Dog on Couch Detector")

while True:
image = capture_image()
Expand Down
22 changes: 17 additions & 5 deletions docs/docs/getting-started/5-streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ A quick example to get used to setting up detectors and asking good questions: s
Ensure you have Python 3.7 or higher installed, and then install the Groundlight SDK and OpenCV library:

```bash
# MacOS
brew install ffmpeg

# Ubuntu/Fedora linux
sudo apt install -y ffmpeg

pip install groundlight pillow ffmpeg yt-dlp typer
```

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

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

2. Log in to the [Groundlight application](https://app.groundlight.ai) and get an [API Token](api-tokens).
2. Ensure that the script has execute permissions. You can add execute permissions using the following command:

```
chmod +x get_latest_frame.sh
```

3. Log in to the [Groundlight application](https://app.groundlight.ai) and get an [API Token](api-tokens).

3. Next, we'll write the Python script for the application.
4. Next, we'll write the Python script for the application.

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

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

```

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

```bash
python streaming_alert.py <VIDEO_ID> --detector_name <DETECTOR_NAME> --query <QUERY IN QUOTATION MARKS>
python streaming_alert.py --video-id=<VIDEO_ID> --detector-name=<DETECTOR_NAME> --query=<QUERY IN QUOTATION MARKS>
```

6 changes: 3 additions & 3 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Note: type annotations allow type checking and IDEs autocompletion

// Options: https://github.com/FormidableLabs/prism-react-renderer/tree/master/src/themes
const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/vsDark");
const lightCodeTheme = require("prism-react-renderer").themes.github;
const darkCodeTheme = require("prism-react-renderer").themes.vsDark;

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand Down Expand Up @@ -100,7 +100,7 @@ const config = {
},
{
href: "pathname:///python-sdk/api-reference-docs/",
label: 'API Reference',
label: "API Reference",
position: "left",
},
{
Expand Down
Loading

0 comments on commit 0885b2b

Please sign in to comment.