| | import streamlit as st |
| | from utils.ai_functions import generate_historical_dialogue |
| |
|
| | def show_historical_personalities(): |
| | st.title("Interact with Historical Personalities") |
| | st.write("Engage in dynamic, educational dialogues with AI-generated historical figures.") |
| | |
| | |
| | if 'conversation_history' not in st.session_state: |
| | st.session_state.conversation_history = [] |
| |
|
| | |
| | personality = st.selectbox("Choose a historical personality", ["Albert Einstein", "William Shakespeare", "Cleopatra", "Leonardo da Vinci", "Marie Curie"]) |
| | user_input = st.text_input("Ask a question or start a conversation:") |
| | |
| | if st.button("Generate Response"): |
| | if user_input: |
| | with st.spinner(f"Generating response from {personality}..."): |
| | response = generate_historical_dialogue(personality, user_input) |
| |
|
| | |
| | st.session_state.conversation_history.append(f"You: {user_input}") |
| | st.session_state.conversation_history.append(f"{personality}: {response}") |
| | |
| | |
| | st.write(f"{personality}: {response}") |
| | else: |
| | st.warning("Please enter a question or statement to start the conversation.") |
| | |
| | |
| | if len(st.session_state.conversation_history) > 0: |
| | st.subheader("Conversation History") |
| | for entry in st.session_state.conversation_history: |
| | st.text(entry) |
| |
|
| | |
| | if __name__ == "__main__": |
| | show_historical_personalities() |
| |
|