liv / app.py
rashid01's picture
Update app.py
f063860 verified
import streamlit as st
from langchain import LLMChain
st.title("ChefMate")
# Initialize session states
if "chat_history" not in st.session_state:
st.session_state.chat_history = []
if "quiz_state" not in st.session_state:
st.session_state.quiz_state = {
"question_index": 0,
"score": [],
"in_progress": False
}
if "current_page" not in st.session_state:
st.session_state.current_page = 0
# Function to get data response
def get_data_response(question):
prompt = f"Provide information on the following topic for 'The Chef Story': {question}"
llm_chain = LLMChain(prompt)
response = llm_chain.run()
return response
# Function to handle the quiz game
def handle_quiz():
# Your existing quiz handling code here
# Function to display menu with prices and offers
display_menu()
# User input for customer queries
user_input = st.text_input("Ask about our menu, offers, events, or anything else:")
if user_input:
response = get_data_response(user_input)
st.session_state.chat_history.append({"role": "user", "content": user_input})
st.session_state.chat_history.append({"role": "bot", "content": response})
# Display chat history
if st.session_state.chat_history:
for message in st.session_state.chat_history:
st.markdown(f"**{message['role'].capitalize()}:** {message['content']}")
# Quiz section
st.subheader("Fun Quiz")
handle_quiz()