Divyansh12 commited on
Commit
a7866db
1 Parent(s): 09e3194

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -33,10 +33,12 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
33
  top_p=top_p
34
  )
35
 
 
36
  for chunk in response_stream:
37
  if len(chunk['choices'][0]["delta"]) != 0 and "content" in chunk['choices'][0]["delta"]:
38
  response += chunk['choices'][0]["delta"]["content"]
39
- yield response
 
40
 
41
  # Streamlit UI
42
  st.title("Chatbot Application")
@@ -56,7 +58,7 @@ if 'history' not in st.session_state:
56
  if st.button("Send"):
57
  # Get the response from the model
58
  response = respond(user_message, st.session_state.history, system_message, max_tokens, temperature, top_p)
59
-
60
  # Add user message and model response to history
61
  st.session_state.history.append((user_message, response))
62
 
 
33
  top_p=top_p
34
  )
35
 
36
+ # Collect the response chunks
37
  for chunk in response_stream:
38
  if len(chunk['choices'][0]["delta"]) != 0 and "content" in chunk['choices'][0]["delta"]:
39
  response += chunk['choices'][0]["delta"]["content"]
40
+
41
+ return response # Return the full response
42
 
43
  # Streamlit UI
44
  st.title("Chatbot Application")
 
58
  if st.button("Send"):
59
  # Get the response from the model
60
  response = respond(user_message, st.session_state.history, system_message, max_tokens, temperature, top_p)
61
+
62
  # Add user message and model response to history
63
  st.session_state.history.append((user_message, response))
64