ruslanmv commited on
Commit
2c10389
·
verified ·
1 Parent(s): e897ba9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -90,14 +90,13 @@ if prompt := st.chat_input("Type your message..."):
90
  # Handle API response
91
  if isinstance(output, list) and len(output) > 0 and 'generated_text' in output[0]:
92
  assistant_response = output[0]['generated_text']
93
- else:
94
- st.error("Error: Unable to generate a response. Please try again.")
95
- continue # Skip further execution for this iteration
96
 
97
- with st.chat_message("assistant"):
98
- st.markdown(assistant_response)
99
 
100
- st.session_state.messages.append({"role": "assistant", "content": assistant_response})
 
 
101
 
102
  except Exception as e:
103
- st.error(f"Application Error: {str(e)}")
 
90
  # Handle API response
91
  if isinstance(output, list) and len(output) > 0 and 'generated_text' in output[0]:
92
  assistant_response = output[0]['generated_text']
 
 
 
93
 
94
+ with st.chat_message("assistant"):
95
+ st.markdown(assistant_response)
96
 
97
+ st.session_state.messages.append({"role": "assistant", "content": assistant_response})
98
+ else:
99
+ st.error("Error: Unable to generate a response. Please try again.")
100
 
101
  except Exception as e:
102
+ st.error(f"Application Error: {str(e)}")