Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -38,8 +38,6 @@ screen = gr.Checkbox(label="Screen Interaction")
|
|
38 |
video_description = gr.Textbox(label="Video Description", show_label=True, show_copy_button=True)
|
39 |
json_output = gr.JSON(label="JSON Output")
|
40 |
|
41 |
-
# Button to trigger JSON processing
|
42 |
-
process_json_button = gr.Button("Process JSON")
|
43 |
|
44 |
# Examples for the interface
|
45 |
examples = [
|
@@ -67,8 +65,9 @@ custom_theme = gr.themes.Soft(
|
|
67 |
neutral_hue="zinc"
|
68 |
)
|
69 |
|
|
|
70 |
interface = gr.Interface(
|
71 |
-
fn=
|
72 |
inputs=[video, sitting, hands, location, screen],
|
73 |
outputs=video_description,
|
74 |
examples=examples,
|
@@ -77,13 +76,16 @@ interface = gr.Interface(
|
|
77 |
article=article,
|
78 |
theme=custom_theme,
|
79 |
allow_flagging="never",
|
|
|
80 |
)
|
81 |
|
82 |
-
#
|
83 |
-
|
84 |
-
fn=process_and_display_json,
|
85 |
-
inputs=video_description,
|
86 |
-
outputs=json_output
|
87 |
-
|
|
|
|
|
88 |
|
89 |
-
interface.launch(debug=False)
|
|
|
38 |
video_description = gr.Textbox(label="Video Description", show_label=True, show_copy_button=True)
|
39 |
json_output = gr.JSON(label="JSON Output")
|
40 |
|
|
|
|
|
41 |
|
42 |
# Examples for the interface
|
43 |
examples = [
|
|
|
65 |
neutral_hue="zinc"
|
66 |
)
|
67 |
|
68 |
+
# --- Create the Interface ---
|
69 |
interface = gr.Interface(
|
70 |
+
fn=process_video,
|
71 |
inputs=[video, sitting, hands, location, screen],
|
72 |
outputs=video_description,
|
73 |
examples=examples,
|
|
|
76 |
article=article,
|
77 |
theme=custom_theme,
|
78 |
allow_flagging="never",
|
79 |
+
live=True # Add live=True here
|
80 |
)
|
81 |
|
82 |
+
# --- Add the JSON processing component with live updates ---
|
83 |
+
interface.add_component(
|
84 |
+
fn=process_and_display_json,
|
85 |
+
inputs=video_description, # This will take output from process_video
|
86 |
+
outputs=json_output,
|
87 |
+
live=True,
|
88 |
+
live_inputs=[0] # Update based on the first input (video_description)
|
89 |
+
)
|
90 |
|
91 |
+
interface.launch(debug=False)
|