diff --git a/build/figurines/microcontroller_comms.py b/build/figurines/microcontroller_comms.py index c6cd2e8..05636a7 100644 --- a/build/figurines/microcontroller_comms.py +++ b/build/figurines/microcontroller_comms.py @@ -137,7 +137,7 @@ def main(): if serialPort.is_open: try: response = json.loads( - requests.get('http://127.0.0.1:8000/figurines').text + requests.get('http://127.0.0.1:8000/figurines', timeout=5).text ) if response != figurine_status: figurine_status = response diff --git a/build/vision/reader.py b/build/vision/reader.py index d3ecc2c..ab915e4 100644 --- a/build/vision/reader.py +++ b/build/vision/reader.py @@ -3,6 +3,7 @@ from collections import namedtuple import numpy as np +import requests import pytesseract from camera_constants import left from camera_constants import time_slot_height @@ -17,6 +18,8 @@ Point = namedtuple('Point', ['X', 'Y']) TimeSlot = namedtuple('TimeSlot', ['top_left', 'bottom_right']) +USER_NAME = "family" + def main(image: Image): """ @@ -59,9 +62,15 @@ def main(image: Image): 'colour': ','.join(colour), # logic to get out of list } ) + + request_body = {"body": coloured_time_slots} + try: + requests.post(f"http://127.0.0.1:8000/whiteboard/{USER_NAME}", json=request_body, timeout=30) + except requests.exceptions.ConnectionError as e: + print(f"Error making HTTP request - {e}") - with open('coloured_time_slots.json', 'w') as json_file: - json.dump(coloured_time_slots, json_file, indent=4) + # with open('coloured_time_slots.json', 'w') as json_file: + # json.dump(coloured_time_slots, json_file, indent=4) def get_info(time_slot_array: np.ndarray) -> (bool, [str], str): diff --git a/environment.yaml b/environment.yaml index bc191ba..e7bb9ad 100644 --- a/environment.yaml +++ b/environment.yaml @@ -1,16 +1,19 @@ ---- name: lambda-env -channels: [conda-forge, defaults] +channels: + - conda-forge + - defaults dependencies: - annotated-types=0.6.0=pyhd8ed1ab_0 - anyio=3.7.1=pyhd8ed1ab_0 - blas=1.0=openblas - brotli=1.0.9=h1a28f6b_7 - brotli-bin=1.0.9=h1a28f6b_7 + - brotlipy=0.7.0=py311h80987f9_1002 - bzip2=1.0.8=h620ffc9_4 - - ca-certificates=2023.7.22=hf0a4a13_0 - - certifi=2023.7.22=pyhd8ed1ab_0 + - ca-certificates=2023.08.22=hca03da5_0 + - certifi=2023.7.22=py311hca03da5_0 - cffi=1.16.0=py311h4a08483_0 + - charset-normalizer=2.0.4=pyhd3eb1b0_0 - click=8.1.7=unix_pyh707e725_0 - contourpy=1.0.5=py311h48ca7d4_0 - cryptography=41.0.4=py311h5fb2c35_0 @@ -71,7 +74,9 @@ dependencies: - pydantic=2.4.2=pyhd8ed1ab_0 - pydantic-core=2.10.1=py311h0563b04_0 - pymongo=4.5.0=py311ha891d26_1 + - pyopenssl=23.2.0=py311hca03da5_0 - pyparsing=3.0.9=py311hca03da5_0 + - pysocks=1.7.1=py311hca03da5_0 - pytesseract=0.3.10=py311hca03da5_0 - python=3.11.6=h47c9636_0_cpython - python-dateutil=2.8.2=pyhd3eb1b0_0 @@ -79,6 +84,7 @@ dependencies: - python_abi=3.11=4_cp311 - pyyaml=6.0.1=py311heffc1b2_1 - readline=8.2=h1a28f6b_0 + - requests=2.31.0=py311hca03da5_0 - setuptools=68.0.0=py311hca03da5_0 - six=1.16.0=pyhd3eb1b0_1 - sniffio=1.3.0=pyhd8ed1ab_0 @@ -90,6 +96,7 @@ dependencies: - typing-extensions=4.8.0=hd8ed1ab_0 - typing_extensions=4.8.0=pyha770c72_0 - tzdata=2023c=h04d1e81_0 + - urllib3=1.26.16=py311hca03da5_0 - uvicorn=0.23.2=py311h267d04e_1 - uvicorn-standard=0.23.2=ha1ab1f8_1 - uvloop=0.17.0=py311heffc1b2_2 @@ -100,5 +107,6 @@ dependencies: - yaml=0.2.5=h3422bc3_2 - zlib=1.2.13=h53f4e23_5 - zstd=1.5.5=hd90d995_0 - - pip: [opencv-python-headless==4.8.1.78] -prefix: /Users/alexviller/miniconda3/envs/lambda-vision + - pip: + - opencv-python-headless==4.8.1.78 +prefix: /opt/homebrew/Caskroom/miniconda/base/envs/lambda-env