dmayhem93 commited on
Commit
d0ede55
·
verified ·
1 Parent(s): dae5118

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -25
app.py CHANGED
@@ -47,39 +47,15 @@ def chat(message, history):
47
  t = Thread(target=m.generate, kwargs=generate_kwargs)
48
  t.start()
49
 
50
- # print(history)
51
  # Initialize an empty string to store the generated text
52
  partial_text = ""
53
  for new_text in streamer:
54
  # print(new_text)
55
  partial_text += new_text
56
- history[-1][1] = partial_text
57
  # Yield an empty string to cleanup the message textbox and the updated conversation history
58
- yield history
59
- return partial_text
60
 
61
 
62
- # with gr.Blocks() as demo:
63
- # # history = gr.State([])
64
- # gr.Markdown("## Stable LM 2 Zephyr 1.6b")
65
- # gr.HTML('''<center><a href="https://huggingface.co/spaces/stabilityai/stablelm-2-1_6b-zephyr?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space to skip the queue and run in a private space</center>''')
66
- # chatbot = gr.Chatbot().style(height=500)
67
- # with gr.Row():
68
- # with gr.Column():
69
- # msg = gr.Textbox(label="Chat Message Box", placeholder="Chat Message Box",
70
- # show_label=False).style(container=False)
71
- # with gr.Column():
72
- # with gr.Row():
73
- # submit = gr.Button("Submit")
74
- # stop = gr.Button("Stop")
75
- # clear = gr.Button("Clear")
76
 
77
- # submit_event = msg.submit(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot], queue=False).then(
78
- # fn=chat, inputs=[chatbot], outputs=[chatbot], queue=True)
79
- # submit_click_event = submit.click(fn=user, inputs=[msg, chatbot], outputs=[msg, chatbot], queue=False).then(
80
- # fn=chat, inputs=[chatbot], outputs=[chatbot], queue=True)
81
- # stop.click(fn=None, inputs=None, outputs=None, cancels=[
82
- # submit_event, submit_click_event], queue=False)
83
- # clear.click(lambda: None, None, [chatbot], queue=False)
84
  demo = gr.ChatInterface(fn=chat, examples=["hello", "hola", "merhaba"], title="Stable LM 2 Zephyr 1.6b")
85
  demo.launch()
 
47
  t = Thread(target=m.generate, kwargs=generate_kwargs)
48
  t.start()
49
 
 
50
  # Initialize an empty string to store the generated text
51
  partial_text = ""
52
  for new_text in streamer:
53
  # print(new_text)
54
  partial_text += new_text
 
55
  # Yield an empty string to cleanup the message textbox and the updated conversation history
56
+ yield partial_text
 
57
 
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
 
 
 
 
 
 
 
60
  demo = gr.ChatInterface(fn=chat, examples=["hello", "hola", "merhaba"], title="Stable LM 2 Zephyr 1.6b")
61
  demo.launch()