Spaces:
Sleeping
Sleeping
gabehubner
commited on
Commit
·
27ff6a9
1
Parent(s):
95a5a2a
hello
Browse files
app.py
CHANGED
@@ -41,7 +41,11 @@ def generate_output(num_iterations, option):
|
|
41 |
|
42 |
def get_frame_and_attribution(slider_value):
|
43 |
global frames, attributions
|
|
|
44 |
frame = frames[slider_value]
|
|
|
|
|
|
|
45 |
attribution = display_softmax(attributions[slider_value])
|
46 |
|
47 |
return frame, attribution
|
@@ -57,7 +61,7 @@ with gr.Blocks() as demo:
|
|
57 |
option = gr.Dropdown(choices=["Torch Tensor of 0's", "Running Average"], type="index")
|
58 |
baselines = gr.Slider(label="Number of Baseline Iterations", interactive=True, minimum=0, maximum=100, value=10, step=5, info="Baseline inputs to collect for the average", render=True)
|
59 |
gr.Button("ATTRIBUTE").click(fn=generate_output, inputs=[baselines, option])
|
60 |
-
slider = gr.Slider(label="Key Frame", minimum=0, maximum=
|
61 |
|
62 |
gr.Interface(fn=get_frame_and_attribution, inputs=slider, live=True, outputs=[gr.Image(), gr.Label()])
|
63 |
|
|
|
41 |
|
42 |
def get_frame_and_attribution(slider_value):
|
43 |
global frames, attributions
|
44 |
+
slider_value = min(slider_value, len(frames) - 1)
|
45 |
frame = frames[slider_value]
|
46 |
+
|
47 |
+
print(f"{frame.shape=}")
|
48 |
+
|
49 |
attribution = display_softmax(attributions[slider_value])
|
50 |
|
51 |
return frame, attribution
|
|
|
61 |
option = gr.Dropdown(choices=["Torch Tensor of 0's", "Running Average"], type="index")
|
62 |
baselines = gr.Slider(label="Number of Baseline Iterations", interactive=True, minimum=0, maximum=100, value=10, step=5, info="Baseline inputs to collect for the average", render=True)
|
63 |
gr.Button("ATTRIBUTE").click(fn=generate_output, inputs=[baselines, option])
|
64 |
+
slider = gr.Slider(label="Key Frame", minimum=0, maximum=1000, step=1, value=0)
|
65 |
|
66 |
gr.Interface(fn=get_frame_and_attribution, inputs=slider, live=True, outputs=[gr.Image(), gr.Label()])
|
67 |
|