ManishThota commited on
Commit
f274670
·
verified ·
1 Parent(s): 4cfac13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -21
app.py CHANGED
@@ -35,16 +35,16 @@ def process_and_display_text():
35
 
36
  # ... (Gradio interface code) ...
37
 
38
- video = gr.Video(label="Video")
39
- sitting = gr.Checkbox(label="Sitting/Standing")
40
- hands = gr.Checkbox(label="Hands Free/Not Free")
41
- location = gr.Checkbox(label="Indoors/Outdoors")
42
- screen = gr.Checkbox(label="Screen Interaction")
43
 
44
  # Output components
45
- video_description = gr.Textbox(label="Video Description")
46
- json_output = gr.JSON(label="JSON Output")
47
- process_button = gr.Button("Process Text", visible=False)
48
 
49
  # Examples for the interface
50
  examples = [
@@ -71,19 +71,34 @@ custom_theme = gr.themes.Soft(
71
  secondary_hue="red"
72
  )
73
 
74
- interface = gr.Interface(
75
- fn=process_video,
76
- inputs=[video, sitting, hands, location, screen],
77
- outputs=[process_button, video_description],
78
- examples=examples,
79
- title=title,
80
- description=description,
81
- article=article,
82
- theme=custom_theme,
83
- allow_flagging="never",
84
- )
85
 
86
- # Click event for the "Process Text" button
87
- process_button.click(fn=process_and_display_text, outputs=json_output)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
  interface.launch(debug=False)
 
35
 
36
  # ... (Gradio interface code) ...
37
 
38
+ #video = gr.Video(label="Video")
39
+ #sitting = gr.Checkbox(label="Sitting/Standing")
40
+ #hands = gr.Checkbox(label="Hands Free/Not Free")
41
+ #location = gr.Checkbox(label="Indoors/Outdoors")
42
+ #screen = gr.Checkbox(label="Screen Interaction")
43
 
44
  # Output components
45
+ #video_description = gr.Textbox(label="Video Description")
46
+ #json_output = gr.JSON(label="JSON Output")
47
+ #process_button = gr.Button("Process Text", visible=False)
48
 
49
  # Examples for the interface
50
  examples = [
 
71
  secondary_hue="red"
72
  )
73
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
+ with gr.Blocks(theme=custom_theme) as demo: # Use 'with' for gr.Blocks
76
+ video = gr.Video(label="Video")
77
+ sitting = gr.Checkbox(label="Sitting/Standing")
78
+ hands = gr.Checkbox(label="Hands Free/Not Free")
79
+ location = gr.Checkbox(label="Indoors/Outdoors")
80
+ screen = gr.Checkbox(label="Screen Interaction")
81
+
82
+ # Output components
83
+ video_description = gr.Textbox(label="Video Description")
84
+ json_output = gr.JSON(label="JSON Output")
85
+ process_button = gr.Button("Process Text", visible=False)
86
+
87
+ # --- Connect inputs and outputs within gr.Blocks ---
88
+ interface = gr.Interface(
89
+ fn=process_video,
90
+ inputs=[video, sitting, hands, location, screen],
91
+ outputs=[process_button, video_description],
92
+ examples=examples,
93
+ title=title,
94
+ description=description,
95
+ article=article,
96
+ allow_flagging="never",
97
+ )
98
+ interface.launch(debug=False)
99
+
100
+ # --- Button click event handler ---
101
+ process_button.click(fn=process_and_display_text, outputs=json_output)# Click event for the "Process Text" button
102
+
103
 
104
  interface.launch(debug=False)