Commit
·
10e0844
1
Parent(s):
61f16e5
Update app.py
Browse files
app.py
CHANGED
@@ -269,26 +269,26 @@ def translate_sign_language(gesture):
|
|
269 |
idx_to_label = model_pretrained.config.id2label
|
270 |
gesture_translation = idx_to_label[predicted_prod_label.cpu().numpy().item()] # Convert to a scalar
|
271 |
|
272 |
-
|
273 |
-
def frame_generator():
|
274 |
-
|
275 |
-
|
276 |
|
277 |
-
return gesture_translation , frame_generator
|
278 |
|
279 |
with gr.Blocks() as demo:
|
280 |
gr.Markdown("# Indian Sign Language Translation App")
|
281 |
|
282 |
# Gesture recognition Tab
|
283 |
with gr.Tab("Gesture recognition"):
|
284 |
-
with gr.Row(height=
|
285 |
with gr.Column(scale=1, variant="panel"):
|
286 |
# Add webcam input for sign language video capture
|
287 |
video_input = gr.Video(format="mp4", label="Gesture")
|
288 |
with gr.Column(scale=1, variant="panel"):
|
289 |
# Display the landmarked video
|
290 |
-
video_output = gr.Video(streaming=
|
291 |
-
with gr.Row(variant="panel", equal_height=
|
292 |
# Submit the Video
|
293 |
video_button = gr.Button("Submit")
|
294 |
# Add a button or functionality to process the video
|
@@ -298,7 +298,7 @@ with gr.Blocks() as demo:
|
|
298 |
|
299 |
# Indian Sign Language gesture reference tab
|
300 |
with gr.Tab("Indian Sign Language gesture reference"):
|
301 |
-
with gr.Row(
|
302 |
with gr.Column(scale=1, variant="panel"):
|
303 |
video_dropdown = gr.Dropdown(choices=list_videos(), label="ISL gestures", info="More gestures comming soon!")
|
304 |
search_button = gr.Button("Search Gesture")
|
|
|
269 |
idx_to_label = model_pretrained.config.id2label
|
270 |
gesture_translation = idx_to_label[predicted_prod_label.cpu().numpy().item()] # Convert to a scalar
|
271 |
|
272 |
+
## Frame generator for real-time streaming
|
273 |
+
#def frame_generator():
|
274 |
+
# for frame in prod_video:
|
275 |
+
# yield frame # Stream frame-by-frame
|
276 |
|
277 |
+
return gesture_translation , prod_video#, frame_generator
|
278 |
|
279 |
with gr.Blocks() as demo:
|
280 |
gr.Markdown("# Indian Sign Language Translation App")
|
281 |
|
282 |
# Gesture recognition Tab
|
283 |
with gr.Tab("Gesture recognition"):
|
284 |
+
with gr.Row(height=500, variant="panel", equal_height=True, show_progress=True):
|
285 |
with gr.Column(scale=1, variant="panel"):
|
286 |
# Add webcam input for sign language video capture
|
287 |
video_input = gr.Video(format="mp4", label="Gesture")
|
288 |
with gr.Column(scale=1, variant="panel"):
|
289 |
# Display the landmarked video
|
290 |
+
video_output = gr.Video(streaming=False, label="Landmarked Gesture")
|
291 |
+
with gr.Row(variant="panel", equal_height=False, show_progress=True):
|
292 |
# Submit the Video
|
293 |
video_button = gr.Button("Submit")
|
294 |
# Add a button or functionality to process the video
|
|
|
298 |
|
299 |
# Indian Sign Language gesture reference tab
|
300 |
with gr.Tab("Indian Sign Language gesture reference"):
|
301 |
+
with gr.Row(height=500, variant="panel", equal_height=False, show_progress=True):
|
302 |
with gr.Column(scale=1, variant="panel"):
|
303 |
video_dropdown = gr.Dropdown(choices=list_videos(), label="ISL gestures", info="More gestures comming soon!")
|
304 |
search_button = gr.Button("Search Gesture")
|