Skip to content

Commit c1c9b8e

Browse files
authored
Update pipeline.py
1 parent 95401a1 commit c1c9b8e

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

pipeline/pipeline.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
#
2-
# Flowmotion
3-
# Pipeline
4-
#
1+
from api import APIClient
2+
from TrafficImage import TrafficImage
53

64
if __name__ == "__main__":
7-
# TODO: pipeline code starts here
8-
pass
9-
5+
apiclient = APIClient("https://api.data.gov.sg/v1/transport/traffic-images")
6+
active_cameraIDs = apiclient.camera_id_array
7+
current_traffic_camera_objects = [] #array of TrafficImage objects
8+
9+
#populating array of TrafficImage objects
10+
for camera_id in active_cameraIDs:
11+
image_url = apiclient.extract_image(camera_id)
12+
longitude, latitude = apiclient.extract_latlon(camera_id)
13+
traffic_camera_obj = TrafficImage(camera_id=camera_id, image=image_url, longitude=longitude, latitude=latitude)
14+
current_traffic_camera_objects.append(traffic_camera_obj)
15+
16+
# MLmodel(current_traffic_camera_objects)
17+
18+

0 commit comments

Comments
 (0)