Spaces:
Running
on
T4
Running
on
T4
clear states for frame components
Browse files
app.py
CHANGED
@@ -232,6 +232,13 @@ def getStartEndPoints(mask):
|
|
232 |
|
233 |
return x1, y1, x2, y2
|
234 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
235 |
|
236 |
with gr.Blocks() as demo:
|
237 |
original_frame_list = gr.State([])
|
@@ -260,6 +267,7 @@ with gr.Blocks() as demo:
|
|
260 |
|
261 |
in_video.change(fn=get_first_frame, inputs=[
|
262 |
in_video], outputs=[first_frame])
|
|
|
263 |
approve_mask.click(lambda x: [x['image'], x['mask']], first_frame, [
|
264 |
original_image, masked_image])
|
265 |
track_mask.click(fn=track_and_mask, inputs=[
|
|
|
232 |
|
233 |
return x1, y1, x2, y2
|
234 |
|
235 |
+
def reset_frame_components(first_frame, original_image, masked_image):
|
236 |
+
first_frame.value = None
|
237 |
+
original_image.value = None
|
238 |
+
masked_image.value = None
|
239 |
+
|
240 |
+
return first_frame, original_image, masked_image
|
241 |
+
|
242 |
|
243 |
with gr.Blocks() as demo:
|
244 |
original_frame_list = gr.State([])
|
|
|
267 |
|
268 |
in_video.change(fn=get_first_frame, inputs=[
|
269 |
in_video], outputs=[first_frame])
|
270 |
+
in_video.clear(fn=reset_frame_components, inputs=[first_frame, original_image, masked_image], outputs=[first_frame, original_image, masked_image])
|
271 |
approve_mask.click(lambda x: [x['image'], x['mask']], first_frame, [
|
272 |
original_image, masked_image])
|
273 |
track_mask.click(fn=track_and_mask, inputs=[
|