Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -91,8 +91,11 @@ def get_random_video():
|
|
91 |
video_path2 = get_video_path_local(model_name_2, type, prompt)
|
92 |
return video_path1, video_path2, model_name_1, model_name_2, type, prompt
|
93 |
|
94 |
-
def update_prompt_options(type):
|
95 |
-
|
|
|
|
|
|
|
96 |
|
97 |
|
98 |
def display_videos(type, prompt, model_name_1, model_name_2):
|
@@ -117,13 +120,15 @@ with gr.Blocks() as interface:
|
|
117 |
model_name_2_output = gr.Dropdown(label="Model Name 2", choices=model_names, value=model_names[1])
|
118 |
video_output_2 = gr.Video(label="Video 2")
|
119 |
|
120 |
-
type_output.change(fn=update_prompt_options, inputs=[type_output], outputs=[prompt_output])
|
121 |
|
122 |
|
123 |
random_button.click(
|
124 |
fn=get_random_video,
|
125 |
outputs=[video_output_1, video_output_2,model_name_1_output, model_name_2_output, type_output, prompt_output, ]
|
126 |
-
)
|
|
|
|
|
127 |
|
128 |
display_button.click(
|
129 |
fn=display_videos,
|
|
|
91 |
video_path2 = get_video_path_local(model_name_2, type, prompt)
|
92 |
return video_path1, video_path2, model_name_1, model_name_2, type, prompt
|
93 |
|
94 |
+
def update_prompt_options(type, value=None):
|
95 |
+
if value:
|
96 |
+
return gr.update(choices=dimension[type], value=value if dimension[type] else None)
|
97 |
+
else:
|
98 |
+
return gr.update(choices=dimension[type], value=dimension[type][0] if dimension[type] else None)
|
99 |
|
100 |
|
101 |
def display_videos(type, prompt, model_name_1, model_name_2):
|
|
|
120 |
model_name_2_output = gr.Dropdown(label="Model Name 2", choices=model_names, value=model_names[1])
|
121 |
video_output_2 = gr.Video(label="Video 2")
|
122 |
|
123 |
+
type_output.change(fn=update_prompt_options, inputs=[type_output,None], outputs=[prompt_output])
|
124 |
|
125 |
|
126 |
random_button.click(
|
127 |
fn=get_random_video,
|
128 |
outputs=[video_output_1, video_output_2,model_name_1_output, model_name_2_output, type_output, prompt_output, ]
|
129 |
+
).then(fn=update_prompt_options,
|
130 |
+
inputs=[type_output, prompt_output],
|
131 |
+
outputs=[prompt_output])
|
132 |
|
133 |
display_button.click(
|
134 |
fn=display_videos,
|