Skip to content

Commit

Permalink
Remove unneccessary file name arg
Browse files Browse the repository at this point in the history
  • Loading branch information
LuckierDodge committed Oct 9, 2024
1 parent 405357f commit b32e110
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/camera_rest_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import cv2
import numpy as np
from fastapi.datastructures import State
from typing_extensions import Annotated
from wei.modules.rest_module import RESTModule
from wei.types.module_types import LocalFileModuleActionResult
from wei.types.step_types import (
ActionRequest,
StepFileResponse,
Expand All @@ -20,25 +20,32 @@
rest_module = RESTModule(
name="camera_node",
version=extract_version(Path(__file__).parent.parent / "pyproject.toml"),
description="An example REST camera implementation",
description="An example REST camera implementation",
model="camera",
)
rest_module.arg_parser.add_argument(
"--camera_address", type=str, help="the camera address", default="/dev/video1"
"--camera_address",
type=str,
help="the address of the camera to attach",
default="/dev/video1",
)


@rest_module.action(
name="take_picture", description="An action that atkes and returns a picture"
name="take_picture",
description="An action that takes and returns a picture",
results=[
LocalFileModuleActionResult(
label="image", description="the image taken from the camera"
),
],
)
def take_picture(
state: State,
action: ActionRequest,
file_name: Annotated[str, "Name of the file to save"] = "image.jpg",
) -> StepResponse:
"""Function to take a picture"""
image_name = file_name
image_path = Path("~/.wei/temp").expanduser() / image_name
image_path = Path("~/.wei/temp").expanduser() / "image.jpg"
image_path.parent.mkdir(parents=True, exist_ok=True)
try:
camera = cv2.VideoCapture(state.camera_address)
Expand Down

0 comments on commit b32e110

Please sign in to comment.