davanstrien HF staff commited on
Commit
b4fc14a
1 Parent(s): 19dd1b9

Refactor generate_and_show and show_voting_buttons functions for improved code readability and maintainability

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -123,10 +123,10 @@ with gr.Blocks(theme=tufte_theme) as demo:
123
  vote_output = gr.Textbox(label="Vote Status", interactive=False, visible=False)
124
 
125
  def generate_and_show(prompt):
126
- return gr.Markdown.update(value="Generating..."), gr.Row(visible=False)
127
 
128
  def show_voting_buttons(blurb):
129
- return blurb, gr.Row(visible=True)
130
 
131
  generate_btn.click(get_and_store_prompt, outputs=prompt_state).then(
132
  generate_and_show, inputs=prompt_state, outputs=[blurb_output, voting_row]
 
123
  vote_output = gr.Textbox(label="Vote Status", interactive=False, visible=False)
124
 
125
  def generate_and_show(prompt):
126
+ return "Generating...", gr.Row.update(visible=False)
127
 
128
  def show_voting_buttons(blurb):
129
+ return blurb, gr.Row.update(visible=True)
130
 
131
  generate_btn.click(get_and_store_prompt, outputs=prompt_state).then(
132
  generate_and_show, inputs=prompt_state, outputs=[blurb_output, voting_row]