abanm commited on
Commit
85940e1
·
verified ·
1 Parent(s): e0af1be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -46,9 +46,9 @@ def call_api(message):
46
  if chunk.strip(): # Ensure the chunk is not empty
47
  try:
48
  # Parse JSON chunk
49
- data = json.loads(chunk)
50
  if "response" in data:
51
- bot_response += data["response"]
52
  except json.JSONDecodeError:
53
  bot_response += "\nError decoding response chunk."
54
 
@@ -81,7 +81,7 @@ if prompt := st.chat_input():
81
 
82
  with st.spinner("Translating Dubs language (Woof Woof!)"):
83
  assistant_message_placeholder = st.chat_message("assistant").empty()
84
- response_stream = call_api_stream(prompt)
85
  assistant_message_placeholder.write_stream(response_stream)
86
 
87
  # Append the final assistant's response to the chat history
 
46
  if chunk.strip(): # Ensure the chunk is not empty
47
  try:
48
  # Parse JSON chunk
49
+ data = json.loads(chunk)
50
  if "response" in data:
51
+ yield data["response"]
52
  except json.JSONDecodeError:
53
  bot_response += "\nError decoding response chunk."
54
 
 
81
 
82
  with st.spinner("Translating Dubs language (Woof Woof!)"):
83
  assistant_message_placeholder = st.chat_message("assistant").empty()
84
+ response_stream = call_api(prompt)
85
  assistant_message_placeholder.write_stream(response_stream)
86
 
87
  # Append the final assistant's response to the chat history