Luigi commited on
Commit
abb9c26
·
1 Parent(s): 5b4536d

increase image editor zone

Browse files
Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -7,6 +7,18 @@ import gradio as gr
7
  from ultralytics import YOLO # Now used for Yolov8spose with integrated tracker & pose estimation
8
  import torch
9
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  # Get the directory where the current script is located.
11
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
12
  EXAMPLE_VIDEO = os.path.join(BASE_DIR, "examples", "faint.mp4")
@@ -270,7 +282,7 @@ def process_video_with_zone(video_file, threshold_secs, velocity_threshold, edit
270
 
271
  # ----------------------------
272
  # Gradio Interface Construction
273
- with gr.Blocks() as demo:
274
  gr.HTML("<style>body { margin: 0; padding: 0; }</style>")
275
  gr.Markdown("## 🚨 Faint Detection in a User-Defined Alert Zone")
276
  gr.Markdown(
@@ -298,7 +310,12 @@ with gr.Blocks() as demo:
298
  )
299
 
300
  load_frame_btn = gr.Button("Load First Frame to Editor")
301
- frame_editor = gr.ImageEditor(label="Draw Alert Zone on this frame (use red brush)", type="numpy",)
 
 
 
 
 
302
  preview_button = gr.Button("Preview Alert Zone")
303
  polygon_info = gr.Textbox(label="Alert Zone Polygon Info", lines=3)
304
  preview_image = gr.Image(label="Alert Zone Preview (Polygon Overlay)", type="numpy")
 
7
  from ultralytics import YOLO # Now used for Yolov8spose with integrated tracker & pose estimation
8
  import torch
9
 
10
+ css = """
11
+ /* This targets the container of the ImageEditor by its element ID */
12
+ #my_image_editor {
13
+ height: 1000px !important; /* Change 600px to your desired height */
14
+ }
15
+
16
+ /* You might also need to target inner elements if the component uses nested divs */
17
+ #my_image_editor .image-editor-canvas {
18
+ height: 1000px !important;
19
+ }
20
+ """
21
+
22
  # Get the directory where the current script is located.
23
  BASE_DIR = os.path.dirname(os.path.abspath(__file__))
24
  EXAMPLE_VIDEO = os.path.join(BASE_DIR, "examples", "faint.mp4")
 
282
 
283
  # ----------------------------
284
  # Gradio Interface Construction
285
+ with gr.Blocks(css=css) as demo:
286
  gr.HTML("<style>body { margin: 0; padding: 0; }</style>")
287
  gr.Markdown("## 🚨 Faint Detection in a User-Defined Alert Zone")
288
  gr.Markdown(
 
310
  )
311
 
312
  load_frame_btn = gr.Button("Load First Frame to Editor")
313
+ # Assign an elem_id for targeting via CSS.
314
+ frame_editor = gr.ImageEditor(
315
+ label="Draw Alert Zone on this frame (use red brush)",
316
+ type="numpy",
317
+ elem_id="my_image_editor"
318
+ )
319
  preview_button = gr.Button("Preview Alert Zone")
320
  polygon_info = gr.Textbox(label="Alert Zone Polygon Info", lines=3)
321
  preview_image = gr.Image(label="Alert Zone Preview (Polygon Overlay)", type="numpy")