kz919 commited on
Commit
3f81f1c
·
verified ·
1 Parent(s): 80702bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -50,8 +50,10 @@ def respond(message, history: list[tuple[str, str]], system_message, max_tokens,
50
  generation_thread.start()
51
 
52
  # Stream the tokens as they are generated
 
53
  for new_text in streamer:
54
- yield new_text
 
55
 
56
 
57
  # Create the Gradio interface
@@ -62,8 +64,7 @@ demo = gr.ChatInterface(
62
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
63
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
64
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
65
- ],
66
- live=True
67
  )
68
 
69
  # Launch the Gradio app
 
50
  generation_thread.start()
51
 
52
  # Stream the tokens as they are generated
53
+ text_buffer = ""
54
  for new_text in streamer:
55
+ text_buffer+=new_text
56
+ yield text_buffer
57
 
58
 
59
  # Create the Gradio interface
 
64
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
65
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
66
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
67
+ ]
 
68
  )
69
 
70
  # Launch the Gradio app