Spaces:
Sleeping
Sleeping
Update app.py
Browse files13 unmodified lines141516171819202119 unmodified lines414243444546474849505152535455565758596013 unmodified lines# Initialize chat historyif 'history' not in st.session_state: st.session_state['history'] = []if 'conversation' not in st.session_state: st.session_state['conversation'] = []
def generate_response(input_text): # Encode the new user input, add end of string token19 unmodified lines # Update session state history with the new tokens (flattened) st.session_state['history'] = chat_history_ids[0].tolist()
# Add both user input and bot response to the conversation history for display st.session_state['conversation'].append(f"You: {input_text}") st.session_state['conversation'].append(f"Bot: {bot_output}")
return bot_output
# Streamlit Interfacest.title("Chat with DialoGPT")
# Display the conversation historyif st.session_state['conversation']: for message in st.session_state['conversation']: st.markdown(f"<p style='color:gray; padding:5px;'>{message}</p>", unsafe_allow_html=True)
# Create input box for useruser_input = st.text_input("You: ", "")
app.py+11