Front-end with Streamlit
Now that we have seen the logic behind an LLM-powered DBCopilot, it is now time to give a GUI to our applicatino. To do so, we will once again leverage Streamlit. As always, you can find the whole Python code in the GitHub book repository at https://github.com/PacktPublishing/Building-Large-Language-Model-Applications.As per the previous sections, also in this case you need to create a .py
file to run in your terminal via streamlit run file.py
. In our case, the file will be named dbcopilot.py
.Below the main steps to setup the front-end:
- Configuring the application webpage:
import streamlit as st
st.set_page_config(page_title="DBCopilot", page_icon="")
st.header(' Welcome to DBCopilot, your copilot for structured databases.')
- Importing the credentials and establishing the connection towards the Chinook database:
load_dotenv()
#os.environ["HUGGINGFACEHUB_API_TOKEN"]
openai_api_key = os.environ['OPENAI_API_KEY&apos...