Spaces:
Running
Running
import streamlit as st | |
from configfile import Config # Import the Config class | |
import os | |
class LoadStreamlitUI: | |
def __init__(self): | |
self.config = Config() # Create a Config instance | |
self.user_controls = {} | |
def load_streamlit_ui(self): | |
st.set_page_config(page_title= "π€ " + self.config.get_page_title(), layout="wide") | |
st.header("π€ " + self.config.get_page_title()) | |
with st.sidebar: | |
# Get options from config | |
llm_options = self.config.get_llm_options() | |
usecase_options = self.config.get_usecase_options() | |
# LLM selection | |
self.user_controls["selected_llm"] = st.selectbox("Select LLM", llm_options) | |
if self.user_controls["selected_llm"] == 'Groq': | |
# Model selection | |
model_options = self.config.get_groq_model_options() | |
self.user_controls["selected_groq_model"] = st.selectbox("Select Model", model_options) | |
# API key input | |
self.user_controls["GROQ_API_KEY"] = st.session_state["GROQ_API_KEY"] = st.text_input("API Key", | |
type="password") | |
# Use case selection | |
self.user_controls["selected_usecase"] = st.selectbox("Select Usecases", usecase_options) | |
if self.user_controls["selected_usecase"] =="Chatbot with Tool": | |
# API key input | |
os.environ["TAVILY_API_KEY"] = self.user_controls["TAVILY_API_KEY"] = st.session_state["TAVILY_API_KEY"] = st.text_input("TAVILY API KEY", | |
type="password") | |
# Use agent description about role | |
# self.user_controls['agent_descriptions'] = st.text_input("Enter the description about an agent",placeholder='eg. You are a helpful assistant that always responds in a polite, upbeat and positive manner.') | |
# st.session_state["chat_with_history"] = st.sidebar.toggle("Chat With History") | |
# self.user_controls['num_history_responses'] = 0 | |
# if st.session_state["chat_with_history"]: | |
# self.user_controls['num_history_responses'] = st.number_input("Enter number of history include from last chat",placeholder="eg. 1",step=1) | |
if self.user_controls['selected_usecase'] == "Appointment Receptionist": | |
col1, col2 = st.columns(2) | |
with col1: | |
st.subheader("Appointment Manager") | |
with col2: | |
st.subheader("Appointments") | |
elif self.user_controls['selected_usecase']=="Custome Support": | |
st.set_page_config(layout='wide', page_title='Flower Shop Chatbot', page_icon='π') | |
return self.user_controls | |