FoodHub / app.py
wankhedes27's picture
Upload app.py with huggingface_hub
a7d3d9e verified
import streamlit as st
from agent_backend import process_message
import logging
logging.basicConfig(level=logging.DEBUG)
print("πŸ”₯ APP.PY STARTED")
st.set_page_config(page_title="FoodHub Chatbot", layout="centered")
st.title("πŸ” FoodHub Customer Support Chatbot")
# -------------------------------------------------------
# Chat history
# -------------------------------------------------------
if "history" not in st.session_state:
st.session_state.history = []
st.markdown("Chat with the FoodHub Assistant below:")
# User input box
user_input = st.text_input("You:", "", key="user_text")
# When Send button is clicked
if st.button("Send"):
if user_input.strip():
response = process_message(user_input)
st.session_state.history.append(("You", user_input))
st.session_state.history.append(("Bot", response))
# Clear input box
st.session_state.user_text = ""
# -------------------------------------------------------
# Display chat
# -------------------------------------------------------
chat_container = st.container()
with chat_container:
for sender, msg in st.session_state.history:
if sender == "You":
st.markdown(f"**πŸ§‘ You:** {msg}")
else:
st.markdown(f"**πŸ€– Bot:** {msg}")
# Auto-scroll
st.write("")