Spaces:
Sleeping
Sleeping
Update app.py
Browse files75 unmodified lines76777879808182838485868788899091929394959697989910010110210310410575 unmodified linesst.title("Fastest AI Chatbot")st.write("Ask a question and get a response.")# Display chat historyfor chat in st.session_state.chat_history:if chat["role"] == "user":st.markdown(f"**You:** {chat['content']}")elif chat["role"] == "assistant":st.markdown(f"**AI:** {chat['content']}")# Text input for user's questionuser_input = st.text_input("Enter your question here:")# Button to trigger responseif st.button("Get Response"):if user_input:# Fetch and display responseresponse = fetch_response(user_input)st.session_state.chat_history.append({"role": "user", "content": user_input})st.session_state.chat_history.append({"role": "assistant", "content": response})# Display new chat history without refreshingst.experimental_rerun()# Display input field at the endst.text_input("Enter your question here:", key="input")# Footerst.markdown("""75 unmodified lines76777879808182838485868788899091929394959697989910010110275 unmodified linesst.title("Fastest AI Chatbot")st.write("Ask a question and get a response.")# Function to display chat historydef display_chat_history():for chat in st.session_state.chat_history:if chat["role"] == "user":st.markdown(f"**You:** {chat['content']}")elif chat["role"] == "assistant":st.markdown(f"**AI:** {chat['content']}")# Display chat historydisplay_chat_history()# Text input for user's questionuser_input = st.text_input("Enter your question here:", key="input")# Button to trigger responseif st.button("Get Response"):if user_input:# Fetch and display responseresponse = fetch_response(user_input)st.experimental_rerun()# Footerst.markdown("""
app.py+10-13