Kaushik066 commited on
Commit
63e4986
·
1 Parent(s): ad98ad4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -40,7 +40,6 @@ CLIP_SIZE = 224
40
  BATCH_SIZE = 1
41
  SEED = 42
42
 
43
-
44
  # Set the device (GPU or CPU)
45
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
46
  # pretrained Model
@@ -49,6 +48,14 @@ MODEL_TRANSFORMER = 'google/vivit-b-16x2'
49
  model_path = 'vivit_pytorch_loss051.pt'
50
  data_path = 'signs'
51
 
 
 
 
 
 
 
 
 
52
  # Create Mediapipe Objects
53
  mp_drawing = mp.solutions.drawing_utils
54
  mp_drawing_styles = mp.solutions.drawing_styles
@@ -304,7 +311,7 @@ def translate_sign_language(gesture):
304
 
305
  return gesture_translation , prod_video_path # frame_generator
306
 
307
- with gr.Blocks() as demo:
308
  gr.Markdown("# Indian Sign Language Translation App")
309
 
310
  # Gesture recognition Tab
@@ -318,8 +325,8 @@ with gr.Blocks() as demo:
318
  # Display the landmarked video
319
  video_output = gr.Video(interactive=False, autoplay=True,
320
  streaming=False, label="Landmarked Gesture",
321
- elem_id="landmarked_video",
322
- style={"max-height": "350px", "width": "auto"})
323
 
324
  with gr.Row(variant="panel"): # equal_height=False, show_progress=True
325
  with gr.Column(scale=1, variant="panel"):
 
40
  BATCH_SIZE = 1
41
  SEED = 42
42
 
 
43
  # Set the device (GPU or CPU)
44
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
45
  # pretrained Model
 
48
  model_path = 'vivit_pytorch_loss051.pt'
49
  data_path = 'signs'
50
 
51
+ # Custom CSS to control output video size
52
+ custom_css = """
53
+ #landmarked_video {
54
+ max-height: 350px;
55
+ width: auto;
56
+ }
57
+ """
58
+
59
  # Create Mediapipe Objects
60
  mp_drawing = mp.solutions.drawing_utils
61
  mp_drawing_styles = mp.solutions.drawing_styles
 
311
 
312
  return gesture_translation , prod_video_path # frame_generator
313
 
314
+ with gr.Blocks(css=custom_css) as demo:
315
  gr.Markdown("# Indian Sign Language Translation App")
316
 
317
  # Gesture recognition Tab
 
325
  # Display the landmarked video
326
  video_output = gr.Video(interactive=False, autoplay=True,
327
  streaming=False, label="Landmarked Gesture",
328
+ elem_id="landmarked_video"
329
+ )
330
 
331
  with gr.Row(variant="panel"): # equal_height=False, show_progress=True
332
  with gr.Column(scale=1, variant="panel"):