Spaces:
Running
Running
zach
commited on
Commit
·
0dde48b
1
Parent(s):
6506ee8
More code clean up
Browse files- src/app.py +4 -9
src/app.py
CHANGED
@@ -109,14 +109,13 @@ def vote(option_mapping: dict, selected_button: str):
|
|
109 |
if not option_mapping:
|
110 |
return gr.update(), gr.update() # No updates if mapping is missing
|
111 |
|
112 |
-
# Determine
|
113 |
is_option_1 = selected_button == VOTE_FOR_OPTION_ONE
|
114 |
-
selected_option = OPTION_ONE if is_option_1 else OPTION_TWO
|
115 |
-
other_option = OPTION_TWO if is_option_1 else OPTION_ONE
|
116 |
|
117 |
# Get provider names
|
118 |
-
selected_provider = option_mapping.get(selected_option,
|
119 |
-
other_provider = option_mapping.get(other_option,
|
120 |
|
121 |
# Return updated button states
|
122 |
return (
|
@@ -216,10 +215,6 @@ def build_gradio_interface() -> gr.Blocks:
|
|
216 |
fn=text_to_speech,
|
217 |
inputs=[prompt_input, generated_text],
|
218 |
outputs=[option1_audio_player, option2_audio_player, option_mapping_state, option2_audio_state]
|
219 |
-
).then(
|
220 |
-
fn=lambda _: gr.update(interactive=True, variation='primary'),
|
221 |
-
inputs=[],
|
222 |
-
outputs=[generate_button]
|
223 |
)
|
224 |
|
225 |
vote_button_1.click(
|
|
|
109 |
if not option_mapping:
|
110 |
return gr.update(), gr.update() # No updates if mapping is missing
|
111 |
|
112 |
+
# Determine selected option
|
113 |
is_option_1 = selected_button == VOTE_FOR_OPTION_ONE
|
114 |
+
selected_option, other_option = (OPTION_ONE, OPTION_TWO) if is_option_1 else (OPTION_TWO, OPTION_ONE)
|
|
|
115 |
|
116 |
# Get provider names
|
117 |
+
selected_provider = option_mapping.get(selected_option, "Unknown")
|
118 |
+
other_provider = option_mapping.get(other_option, "Unknown")
|
119 |
|
120 |
# Return updated button states
|
121 |
return (
|
|
|
215 |
fn=text_to_speech,
|
216 |
inputs=[prompt_input, generated_text],
|
217 |
outputs=[option1_audio_player, option2_audio_player, option_mapping_state, option2_audio_state]
|
|
|
|
|
|
|
|
|
218 |
)
|
219 |
|
220 |
vote_button_1.click(
|