Update app.py
Browse files89 unmodified lines9091929394959697989910010110210389 unmodified lines# Handle API responseif isinstance(output, list) and len(output) > 0 and 'generated_text' in output[0]:assistant_response = output[0]['generated_text']else:st.error("Error: Unable to generate a response. Please try again.")continue # Skip further execution for this iterationwith st.chat_message("assistant"):st.markdown(assistant_response)st.session_state.messages.append({"role": "assistant", "content": assistant_response})except Exception as e:st.error(f"Application Error: {str(e)}")89 unmodified lines9091929394959697989910010110289 unmodified lines# Handle API responseif isinstance(output, list) and len(output) > 0 and 'generated_text' in output[0]:assistant_response = output[0]['generated_text']with st.chat_message("assistant"):st.markdown(assistant_response)st.session_state.messages.append({"role": "assistant", "content": assistant_response})else:st.error("Error: Unable to generate a response. Please try again.")except Exception as e:st.error(f"Application Error: {str(e)}")
app.py+6-7