ChatbotApp / index.py
ctgadget's picture
changed python file for chatbot demo to 'demo_chatbot' and added some error handling in case the user has required files missing.
f1ac257
import streamlit as st
from streamlit_option_menu import option_menu
from chatbotlib import (train_chatbot, demo_chatbot)
# displaying the icon image on streamlit app and set the page config.
st.set_page_config(
layout="wide",
page_title="NLP Chatbot Main Page",
page_icon="💬"
)
# Create sidebar
with st.sidebar:
# icons are located at bootstrap's website: https://icons.getbootstrap.com
page_selection = option_menu(
"NLP Chatbot App",
["Train the Chatbot Model", "Demo the Chatbot"],
icons=["gear", "chat-dots"],
menu_icon="emoji-smile",
default_index=0,
orientation="vertical",
styles={
"container": {"padding": "5!important", "background-color": "#fafafa"},
"icon": {"color": "green", "font-size": "25px"},
"nav-link": {
"font-size": "16px",
"text-align": "left",
"margin": "0px",
"--hover-color": "#eee",
},
"nav-link-selected": {"background-color": "#002D62"},
},
)
# Run the chosen app when selected from the option menu.
match page_selection:
case "Train the Chatbot Model":
train_chatbot.run_app()
case "Demo the Chatbot":
demo_chatbot.run_app()