Sergidev commited on
Commit
ffd4c08
Β·
verified Β·
1 Parent(s): 7f7ba92

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -115,16 +115,19 @@ with gr.Blocks(css="style.css", fill_height=True) as demo:
115
  value=1.2,
116
  )
117
 
118
- complete_button.click(
 
119
  generate,
120
  inputs=[text_box, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
121
  outputs=[text_box],
122
  )
 
 
123
  stop_button.click(
124
  None,
125
  None,
126
  None,
127
- cancels=[complete_button.click]
128
  )
129
 
130
  if __name__ == "__main__":
 
115
  value=1.2,
116
  )
117
 
118
+ # Set up the generation event
119
+ generation_event = complete_button.click(
120
  generate,
121
  inputs=[text_box, max_new_tokens, temperature, top_p, top_k, repetition_penalty],
122
  outputs=[text_box],
123
  )
124
+
125
+ # Set up the stop event
126
  stop_button.click(
127
  None,
128
  None,
129
  None,
130
+ cancels=[generation_event]
131
  )
132
 
133
  if __name__ == "__main__":