Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,24 +91,44 @@ 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 |
|
| 95 |
|
| 96 |
with gr.Blocks() as interface:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
with gr.Row():
|
| 98 |
with gr.Column():
|
| 99 |
-
model_name_1_output = gr.
|
| 100 |
video_output_1 = gr.Video(label="Video 1")
|
| 101 |
with gr.Column():
|
| 102 |
-
model_name_2_output = gr.
|
| 103 |
video_output_2 = gr.Video(label="Video 2")
|
| 104 |
|
| 105 |
-
type_output =
|
| 106 |
-
prompt_output = gr.Textbox(label="Prompt")
|
| 107 |
|
| 108 |
-
|
| 109 |
-
|
| 110 |
fn=get_random_video,
|
| 111 |
-
outputs=[video_output_1, video_output_2, type_output, prompt_output,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
)
|
| 113 |
|
| 114 |
interface.launch()
|
|
|
|
| 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 |
+
return gr.Dropdown.update(choices=dimension[type])
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def display_videos(type, prompt, model_name_1, model_name_2):
|
| 99 |
+
video_path1 = get_video_path_local(model_name_1, type, prompt)
|
| 100 |
+
video_path2 = get_video_path_local(model_name_2, type, prompt)
|
| 101 |
+
return video_path1, video_path2
|
| 102 |
|
| 103 |
|
| 104 |
with gr.Blocks() as interface:
|
| 105 |
+
type_output = gr.Dropdown(label="Type", choices=types, value=types[0])
|
| 106 |
+
prompt_output = gr.Dropdown(label="Prompt", choices=dimension[types[0]], value=dimension[types[0]][0])
|
| 107 |
+
|
| 108 |
+
with gr.Row():
|
| 109 |
+
random_button = gr.Button("🎲 Random 2 videos")
|
| 110 |
+
display_button = gr.Button("⏸ Play options")
|
| 111 |
+
|
| 112 |
with gr.Row():
|
| 113 |
with gr.Column():
|
| 114 |
+
model_name_1_output = gr.Dropdown(label="Model Name 1", choices=model_names, value=model_names[0])
|
| 115 |
video_output_1 = gr.Video(label="Video 1")
|
| 116 |
with gr.Column():
|
| 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,
|
| 130 |
+
inputs=[type_output, prompt_output, model_name_1_output, model_name_2_output],
|
| 131 |
+
outputs=[video_output_1, video_output_2]
|
| 132 |
)
|
| 133 |
|
| 134 |
interface.launch()
|