steveyin commited on
Commit
27ce06b
·
verified ·
1 Parent(s): 8cf8294

Update webapp.py

Browse files
Files changed (1) hide show
  1. webapp.py +5 -30
webapp.py CHANGED
@@ -323,10 +323,6 @@ class DemoCase:
323
  -self.roi_thickness_half + self.roi_height
324
  ),
325
  ]
326
- # region_points = [
327
- # (5, -20 + self.roi_height),
328
- # (self.FRAME_WIDTH - 5, -20 + self.roi_height),
329
- # ]
330
  self.counter = object_counter.ObjectCounter()
331
  self.counter.set_args(
332
  view_img=False,
@@ -835,10 +831,10 @@ class DemoCase:
835
  status_code = 201
836
  # setup object counter & speed estimator
837
  region_points = [
838
- (5, -20 + self.roi_height),
839
- (5, 20 + self.roi_height),
840
- (self.FRAME_WIDTH - 5, 20 + self.roi_height),
841
- (self.FRAME_WIDTH - 5, -20 + self.roi_height),
842
  ]
843
  self.counter = object_counter.ObjectCounter()
844
  self.counter.set_args(
@@ -948,13 +944,9 @@ class DemoCase:
948
  return EventSourceResponse(event_generator())
949
 
950
 
951
- is_huggingface = False
952
- # define the host url and port for webgear server
953
- HOST_WEBGEAR, PORT_WEBGEAR = "localhost", 8080
954
-
955
  # instantiate a demo case
956
  demo_case = DemoCase(YOLO_VERBOSE=False)
957
- demo_case.set_frame_reduction(frame_reduction=10)
958
  demo_case.load_model()
959
  # setup object counter & speed estimator
960
  region_points = [
@@ -1000,15 +992,6 @@ options = {
1000
  "jpeg_compression_fastdct": True,
1001
  "jpeg_compression_fastupsample": True,
1002
  }
1003
- # demo_case.stream0 = CamGear(
1004
- # source=demo_case.url_dict[demo_case.cam_loc],
1005
- # colorspace=None,
1006
- # stream_mode=True,
1007
- # logging=True
1008
- # ).start()
1009
- # if demo_case.stream0 is None:
1010
- # sys.exit("stream unaviable")
1011
-
1012
  web = WebGear(
1013
  logging=True, **options
1014
  )
@@ -1044,11 +1027,3 @@ web.routes.append(Route(
1044
  endpoint=demo_case.sse_outcounts,
1045
  name="sseoutcounts"
1046
  ))
1047
-
1048
- # if is_huggingface is False:
1049
- # # run this app on Uvicorn server at address http://localhost:8080/
1050
- # uvicorn.run(
1051
- # web(), host=HOST_WEBGEAR, port=PORT_WEBGEAR, log_level="info"
1052
- # )
1053
- # # close app safely
1054
- # web.shutdown()
 
323
  -self.roi_thickness_half + self.roi_height
324
  ),
325
  ]
 
 
 
 
326
  self.counter = object_counter.ObjectCounter()
327
  self.counter.set_args(
328
  view_img=False,
 
831
  status_code = 201
832
  # setup object counter & speed estimator
833
  region_points = [
834
+ (5, -self.roi_thickness_half + self.roi_height),
835
+ (5, self.roi_thickness_half + self.roi_height),
836
+ (self.FRAME_WIDTH - 5, self.roi_thickness_half + self.roi_height),
837
+ (self.FRAME_WIDTH - 5, -self.roi_thickness_half + self.roi_height),
838
  ]
839
  self.counter = object_counter.ObjectCounter()
840
  self.counter.set_args(
 
944
  return EventSourceResponse(event_generator())
945
 
946
 
 
 
 
 
947
  # instantiate a demo case
948
  demo_case = DemoCase(YOLO_VERBOSE=False)
949
+ demo_case.set_frame_reduction(frame_reduction=30)
950
  demo_case.load_model()
951
  # setup object counter & speed estimator
952
  region_points = [
 
992
  "jpeg_compression_fastdct": True,
993
  "jpeg_compression_fastupsample": True,
994
  }
 
 
 
 
 
 
 
 
 
995
  web = WebGear(
996
  logging=True, **options
997
  )
 
1027
  endpoint=demo_case.sse_outcounts,
1028
  name="sseoutcounts"
1029
  ))