Spaces:
Runtime error
Runtime error
Miquel Farre
commited on
Commit
·
ceac496
1
Parent(s):
f38285f
app.py
CHANGED
|
@@ -81,13 +81,9 @@ def create_ui(examples_path: str):
|
|
| 81 |
|
| 82 |
status = gr.Markdown()
|
| 83 |
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
visible=False
|
| 88 |
-
)
|
| 89 |
-
|
| 90 |
-
with analysis_accordion:
|
| 91 |
video_description = gr.Markdown("", elem_id="video_desc")
|
| 92 |
highlight_types = gr.Markdown("", elem_id="highlight_types")
|
| 93 |
|
|
@@ -98,8 +94,8 @@ def create_ui(examples_path: str):
|
|
| 98 |
"Please upload a video",
|
| 99 |
"",
|
| 100 |
"",
|
| 101 |
-
|
| 102 |
-
False
|
| 103 |
]
|
| 104 |
|
| 105 |
try:
|
|
@@ -109,8 +105,8 @@ def create_ui(examples_path: str):
|
|
| 109 |
"Video must be shorter than 20 minutes",
|
| 110 |
"",
|
| 111 |
"",
|
| 112 |
-
|
| 113 |
-
False
|
| 114 |
]
|
| 115 |
|
| 116 |
# Load model
|
|
@@ -134,8 +130,8 @@ def create_ui(examples_path: str):
|
|
| 134 |
"Processing complete!",
|
| 135 |
formatted_desc,
|
| 136 |
formatted_highlights,
|
| 137 |
-
temp_output,
|
| 138 |
-
True
|
| 139 |
]
|
| 140 |
|
| 141 |
except Exception as e:
|
|
@@ -143,8 +139,8 @@ def create_ui(examples_path: str):
|
|
| 143 |
f"Error processing video: {str(e)}",
|
| 144 |
"",
|
| 145 |
"",
|
| 146 |
-
|
| 147 |
-
False
|
| 148 |
]
|
| 149 |
|
| 150 |
def process_with_updates(video):
|
|
@@ -153,8 +149,8 @@ def create_ui(examples_path: str):
|
|
| 153 |
"Loading model...",
|
| 154 |
"",
|
| 155 |
"",
|
| 156 |
-
|
| 157 |
-
True
|
| 158 |
]
|
| 159 |
|
| 160 |
# Analyzing video
|
|
@@ -162,8 +158,8 @@ def create_ui(examples_path: str):
|
|
| 162 |
"Analyzing video content...",
|
| 163 |
"",
|
| 164 |
"",
|
| 165 |
-
|
| 166 |
-
True
|
| 167 |
]
|
| 168 |
|
| 169 |
# Get final results
|
|
@@ -175,8 +171,8 @@ def create_ui(examples_path: str):
|
|
| 175 |
"Detecting and extracting highlights...",
|
| 176 |
results[1], # description
|
| 177 |
results[2], # highlights
|
| 178 |
-
|
| 179 |
-
True
|
| 180 |
]
|
| 181 |
|
| 182 |
# Return final state
|
|
@@ -190,7 +186,7 @@ def create_ui(examples_path: str):
|
|
| 190 |
video_description,
|
| 191 |
highlight_types,
|
| 192 |
output_video,
|
| 193 |
-
|
| 194 |
]
|
| 195 |
)
|
| 196 |
|
|
|
|
| 81 |
|
| 82 |
status = gr.Markdown()
|
| 83 |
|
| 84 |
+
# Replace Accordion with Column for visibility control
|
| 85 |
+
with gr.Column(visible=False) as analysis_column:
|
| 86 |
+
gr.Markdown("## Model chain of thought details")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
video_description = gr.Markdown("", elem_id="video_desc")
|
| 88 |
highlight_types = gr.Markdown("", elem_id="highlight_types")
|
| 89 |
|
|
|
|
| 94 |
"Please upload a video",
|
| 95 |
"",
|
| 96 |
"",
|
| 97 |
+
gr.update(visible=False),
|
| 98 |
+
gr.update(visible=False)
|
| 99 |
]
|
| 100 |
|
| 101 |
try:
|
|
|
|
| 105 |
"Video must be shorter than 20 minutes",
|
| 106 |
"",
|
| 107 |
"",
|
| 108 |
+
gr.update(visible=False),
|
| 109 |
+
gr.update(visible=False)
|
| 110 |
]
|
| 111 |
|
| 112 |
# Load model
|
|
|
|
| 130 |
"Processing complete!",
|
| 131 |
formatted_desc,
|
| 132 |
formatted_highlights,
|
| 133 |
+
gr.update(value=temp_output, visible=True),
|
| 134 |
+
gr.update(visible=True)
|
| 135 |
]
|
| 136 |
|
| 137 |
except Exception as e:
|
|
|
|
| 139 |
f"Error processing video: {str(e)}",
|
| 140 |
"",
|
| 141 |
"",
|
| 142 |
+
gr.update(visible=False),
|
| 143 |
+
gr.update(visible=False)
|
| 144 |
]
|
| 145 |
|
| 146 |
def process_with_updates(video):
|
|
|
|
| 149 |
"Loading model...",
|
| 150 |
"",
|
| 151 |
"",
|
| 152 |
+
gr.update(visible=False),
|
| 153 |
+
gr.update(visible=True)
|
| 154 |
]
|
| 155 |
|
| 156 |
# Analyzing video
|
|
|
|
| 158 |
"Analyzing video content...",
|
| 159 |
"",
|
| 160 |
"",
|
| 161 |
+
gr.update(visible=False),
|
| 162 |
+
gr.update(visible=True)
|
| 163 |
]
|
| 164 |
|
| 165 |
# Get final results
|
|
|
|
| 171 |
"Detecting and extracting highlights...",
|
| 172 |
results[1], # description
|
| 173 |
results[2], # highlights
|
| 174 |
+
gr.update(visible=False),
|
| 175 |
+
gr.update(visible=True)
|
| 176 |
]
|
| 177 |
|
| 178 |
# Return final state
|
|
|
|
| 186 |
video_description,
|
| 187 |
highlight_types,
|
| 188 |
output_video,
|
| 189 |
+
analysis_column
|
| 190 |
]
|
| 191 |
)
|
| 192 |
|