Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated API_KEY to ROBOFLOW_API_KEY for clarity #202

Merged
merged 3 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/foundation/gaze.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ import requests
import os

IMG_PATH = "image.jpg"
API_KEY = os.environ["API_KEY"]
ROBOFLOW_API_KEY = os.environ["ROBOFLOW_API_KEY"]
DISTANCE_TO_OBJECT = 1000 # mm
HEIGHT_OF_HUMAN_FACE = 250 # mm
GAZE_DETECTION_URL = "http://127.0.0.1:9001/gaze/gaze_detection?api_key=" + API_KEY
GAZE_DETECTION_URL = "http://127.0.0.1:9001/gaze/gaze_detection?api_key=" + ROBOFLOW_API_KEY

def detect_gazes(frame: np.ndarray):
img_encode = cv2.imencode(".jpg", frame)[1]
img_base64 = base64.b64encode(img_encode)
resp = requests.post(
GAZE_DETECTION_URL,
json={
"api_key": API_KEY,
"api_key": ROBOFLOW_API_KEY,
"image": {"type": "base64", "value": img_base64.decode("utf-8")},
},
)
Expand Down
4 changes: 2 additions & 2 deletions examples/gaze-detection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ git clone https://github.com/roboflow/inference
cd inference/examples/gaze-detection
```

Next, set up a Python environment and install the required project dependencies:
Next, set up a Python environment and install the required project dependencies (this assumes running these bash commands from the above terminal window install):

```bash
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -r ../../requirements/_requirements.txt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested that but I was always thinking that for gaze to work we need also ../../requirements/requirements.gaze.txt - at least this is suggested by setup.py extras that we created to build libs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, only these are required in gaze.py:

import base64
import cv2
import numpy as np
import requests
import os

We can assume the user is installing inference, overall, and have them setup the base _requirements.txt. In the future, we can decide to scope to individual examples.

```

Next, set up a Roboflow Inference Docker container. This Docker container will manage inference for the gaze detection system. [Learn how to set up an Inference Docker container](https://inference.roboflow.com/quickstart/docker/).
Expand Down
6 changes: 3 additions & 3 deletions examples/gaze-detection/gaze.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import os

IMG_PATH = "image.jpg"
API_KEY = os.environ["API_KEY"]
ROBOFLOW_API_KEY = os.environ["ROBOFLOW_API_KEY"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value is fine, as we also allow it in other places as an alternative for API_KEY - in long ran we may decide on single one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use ROBOFLOW_API_KEY across docs. Good note that the API_KEY = os.environ["API_KEY"]
here needs to be updated: https://inference.roboflow.com/foundation/gaze/#how-to-use-l2cs-net

DISTANCE_TO_OBJECT = 1000 # mm
HEIGHT_OF_HUMAN_FACE = 250 # mm
GAZE_DETECTION_URL = "http://127.0.0.1:9001/gaze/gaze_detection?api_key=" + API_KEY
GAZE_DETECTION_URL = "http://127.0.0.1:9001/gaze/gaze_detection?api_key=" + ROBOFLOW_API_KEY


def detect_gazes(frame: np.ndarray):
Expand All @@ -18,7 +18,7 @@ def detect_gazes(frame: np.ndarray):
resp = requests.post(
GAZE_DETECTION_URL,
json={
"api_key": API_KEY,
"api_key": ROBOFLOW_API_KEY,
"image": {"type": "base64", "value": img_base64.decode("utf-8")},
},
)
Expand Down
Loading