Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -253,33 +253,24 @@ def run(frame, sequence_state):
|
|
| 253 |
|
| 254 |
return out_rgb, probs_dict, sequence_state
|
| 255 |
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
inputs=gr.inputs.Image(source="webcam", type="numpy", label="Webcam"),
|
| 275 |
-
outputs=[
|
| 276 |
-
gr.outputs.Image(type="numpy", label="Output (Annotated)"),
|
| 277 |
-
gr.outputs.Label(num_top_classes=5, label="Probabilities (Top 5)"),
|
| 278 |
-
],
|
| 279 |
-
title="Live Sign Language Gesture Demo (CNN-LSTM + Multi-Head Attention)",
|
| 280 |
-
description="Show your hand gesture to the webcam. Prediction starts after 30 frames are collected.",
|
| 281 |
-
live=True,
|
| 282 |
-
)
|
| 283 |
|
| 284 |
if __name__ == "__main__":
|
| 285 |
demo.launch()
|
|
|
|
| 253 |
|
| 254 |
return out_rgb, probs_dict, sequence_state
|
| 255 |
|
| 256 |
+
with gr.Blocks() as demo:
|
| 257 |
+
gr.Markdown("# Live Sign Language Gesture Demo (CNN-LSTM + Multi-Head Attention)")
|
| 258 |
+
gr.Markdown("Show your hand gesture to the webcam. Prediction starts after 30 frames are collected.")
|
| 259 |
+
|
| 260 |
+
seq_state = gr.State([])
|
| 261 |
+
|
| 262 |
+
with gr.Row():
|
| 263 |
+
cam = gr.Image(sources=["webcam"], type="numpy", label="Webcam")
|
| 264 |
+
out_img = gr.Image(type="numpy", label="Output (Annotated)")
|
| 265 |
+
|
| 266 |
+
out_label = gr.Label(num_top_classes=5, label="Probabilities (Top 5)")
|
| 267 |
+
|
| 268 |
+
# Stream events are supported in gradio 4.x
|
| 269 |
+
cam.stream(
|
| 270 |
+
fn=run,
|
| 271 |
+
inputs=[cam, seq_state],
|
| 272 |
+
outputs=[out_img, out_label, seq_state],
|
| 273 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
|
| 275 |
if __name__ == "__main__":
|
| 276 |
demo.launch()
|