janbanot commited on
Commit
4275621
·
1 Parent(s): 3e975db

fix:generate

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -245,8 +245,9 @@ with gr.Blocks(
245
  )
246
 
247
  # Event handlers for button actions to process and clear text
248
- generate_btn.click(
249
- fn=lambda text, style: generate(
 
250
  text,
251
  temperature=0.3,
252
  max_tokens=1024,
@@ -254,7 +255,12 @@ with gr.Blocks(
254
  repetition_penalty=1.1,
255
  top_p=0.95,
256
  prompt_style=STYLE_PROMPTS[style]
257
- ),
 
 
 
 
 
258
  inputs=[input_text, style_dropdown],
259
  outputs=output_text,
260
  )
 
245
  )
246
 
247
  # Event handlers for button actions to process and clear text
248
+ def format_with_style(text, style):
249
+ partial_text = ""
250
+ for chunk in generate(
251
  text,
252
  temperature=0.3,
253
  max_tokens=1024,
 
255
  repetition_penalty=1.1,
256
  top_p=0.95,
257
  prompt_style=STYLE_PROMPTS[style]
258
+ ):
259
+ partial_text = chunk
260
+ yield partial_text
261
+
262
+ generate_btn.click(
263
+ fn=format_with_style,
264
  inputs=[input_text, style_dropdown],
265
  outputs=output_text,
266
  )