za3karia commited on
Commit
e30d93c
·
verified ·
1 Parent(s): 32802ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -6,7 +6,7 @@ client = InferenceClient("HuggingFaceH4/zephyr-7b-beta", token="hf_gzFQTPmbxocKx
6
 
7
  def send_message(message):
8
  messages = [{"role": "user", "content": message}]
9
- response = client.chat_completion(messages, max_tokens=150, stream=True)
10
  return response
11
 
12
  def main():
@@ -17,10 +17,10 @@ def main():
17
 
18
  if st.button("Send"):
19
  with st.spinner('AI is typing...'):
20
- # Send message and display response incrementally
21
- for token in send_message(user_input):
22
- for choice in token.choices:
23
- st.write(choice.delta.content, end="")
24
 
25
  if __name__ == "__main__":
26
  main()
 
6
 
7
  def send_message(message):
8
  messages = [{"role": "user", "content": message}]
9
+ response = client.chat_completion(messages, max_tokens=150)
10
  return response
11
 
12
  def main():
 
17
 
18
  if st.button("Send"):
19
  with st.spinner('AI is typing...'):
20
+ response = send_message(user_input)
21
+ # Display complete response
22
+ for choice in response.choices:
23
+ st.write(choice.message.content)
24
 
25
  if __name__ == "__main__":
26
  main()