Default to 12 FPS
Browse files- app.py +4 -4
- static/index.html +1 -1
app.py
CHANGED
|
@@ -69,7 +69,7 @@ stream_lock = threading.Lock()
|
|
| 69 |
stream_thread = None
|
| 70 |
stream_running = False
|
| 71 |
latest_action = 1 # 0=init, 1=nothing, 2=up, 3=down
|
| 72 |
-
target_fps =
|
| 73 |
frame_index = 0
|
| 74 |
|
| 75 |
noise_buf = None # (1,1,3,24,24) on GPU
|
|
@@ -229,7 +229,7 @@ def initialize_model():
|
|
| 229 |
# Fixed-FPS streaming worker
|
| 230 |
# --------------------------
|
| 231 |
class FrameScheduler(threading.Thread):
|
| 232 |
-
def __init__(self, fps=
|
| 233 |
super().__init__(daemon=True)
|
| 234 |
self.frame_period = 1.0 / max(1, int(fps))
|
| 235 |
self.n_steps = int(n_steps)
|
|
@@ -366,7 +366,7 @@ def generate_frames():
|
|
| 366 |
# --------------------------
|
| 367 |
# Socket events & helpers
|
| 368 |
# --------------------------
|
| 369 |
-
def start_stream(n_steps=8, cfg=0.0, fps=
|
| 370 |
global stream_thread, stream_running, frame_index, target_fps, latest_action
|
| 371 |
if not server_ready:
|
| 372 |
_broadcast_ready()
|
|
@@ -476,7 +476,7 @@ def handle_start_stream(data):
|
|
| 476 |
|
| 477 |
n_steps = int(data.get('n_steps', 8))
|
| 478 |
cfg = float(data.get('cfg', 0))
|
| 479 |
-
fps = int(data.get('fps',
|
| 480 |
clamp = bool(data.get('clamp', True))
|
| 481 |
print(f"Starting stream @ {fps} FPS (n_steps={n_steps}, cfg={cfg}, clamp={clamp})")
|
| 482 |
try:
|
|
|
|
| 69 |
stream_thread = None
|
| 70 |
stream_running = False
|
| 71 |
latest_action = 1 # 0=init, 1=nothing, 2=up, 3=down
|
| 72 |
+
target_fps = 12
|
| 73 |
frame_index = 0
|
| 74 |
|
| 75 |
noise_buf = None # (1,1,3,24,24) on GPU
|
|
|
|
| 229 |
# Fixed-FPS streaming worker
|
| 230 |
# --------------------------
|
| 231 |
class FrameScheduler(threading.Thread):
|
| 232 |
+
def __init__(self, fps=12, n_steps=8, cfg=0.0, clamp=True):
|
| 233 |
super().__init__(daemon=True)
|
| 234 |
self.frame_period = 1.0 / max(1, int(fps))
|
| 235 |
self.n_steps = int(n_steps)
|
|
|
|
| 366 |
# --------------------------
|
| 367 |
# Socket events & helpers
|
| 368 |
# --------------------------
|
| 369 |
+
def start_stream(n_steps=8, cfg=0.0, fps=12, clamp=True):
|
| 370 |
global stream_thread, stream_running, frame_index, target_fps, latest_action
|
| 371 |
if not server_ready:
|
| 372 |
_broadcast_ready()
|
|
|
|
| 476 |
|
| 477 |
n_steps = int(data.get('n_steps', 8))
|
| 478 |
cfg = float(data.get('cfg', 0))
|
| 479 |
+
fps = int(data.get('fps', 12))
|
| 480 |
clamp = bool(data.get('clamp', True))
|
| 481 |
print(f"Starting stream @ {fps} FPS (n_steps={n_steps}, cfg={cfg}, clamp={clamp})")
|
| 482 |
try:
|
static/index.html
CHANGED
|
@@ -37,7 +37,7 @@
|
|
| 37 |
<h1>Pong</h1>
|
| 38 |
<div style="margin-bottom: 12px;">
|
| 39 |
<label style="display: block; margin-bottom: 8px;">
|
| 40 |
-
FPS: <input type="number" id="fpsInput" value="
|
| 41 |
<span style="color: #aaa; font-size: 12px; margin-left: 8px;">frames per second</span>
|
| 42 |
</label>
|
| 43 |
<label style="display: block; margin-bottom: 8px;">
|
|
|
|
| 37 |
<h1>Pong</h1>
|
| 38 |
<div style="margin-bottom: 12px;">
|
| 39 |
<label style="display: block; margin-bottom: 8px;">
|
| 40 |
+
FPS: <input type="number" id="fpsInput" value="12" min="1" max="30" step="1" style="width: 60px; padding: 4px; margin-left: 8px;" />
|
| 41 |
<span style="color: #aaa; font-size: 12px; margin-left: 8px;">frames per second</span>
|
| 42 |
</label>
|
| 43 |
<label style="display: block; margin-bottom: 8px;">
|