Spaces:
Sleeping
Sleeping
refactor: add sleep to frame processing for smoother frame handling and update default show_stats value
Browse files
app.py
CHANGED
@@ -76,6 +76,8 @@ def frame_processor(session_id: str):
|
|
76 |
session.latest_frame = frame
|
77 |
|
78 |
next_frame_time += frame_duration
|
|
|
|
|
79 |
|
80 |
def stream_mjpeg(session_id: str):
|
81 |
global sessions
|
@@ -101,7 +103,7 @@ def video_feed():
|
|
101 |
global sessions
|
102 |
|
103 |
session_id = request.args.get("id", "default")
|
104 |
-
show_stats = request.args.get("show_stats", "
|
105 |
|
106 |
if session_id not in [s.id for s in sessions]:
|
107 |
session = Session(session_id)
|
|
|
76 |
session.latest_frame = frame
|
77 |
|
78 |
next_frame_time += frame_duration
|
79 |
+
else:
|
80 |
+
time.sleep(0.001)
|
81 |
|
82 |
def stream_mjpeg(session_id: str):
|
83 |
global sessions
|
|
|
103 |
global sessions
|
104 |
|
105 |
session_id = request.args.get("id", "default")
|
106 |
+
show_stats = request.args.get("show_stats", "1") == "1"
|
107 |
|
108 |
if session_id not in [s.id for s in sessions]:
|
109 |
session = Session(session_id)
|