Spaces:
Build error
Build error
File size: 2,369 Bytes
7f5673b c77dd9f 7f5673b c77dd9f 7f5673b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
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'] == "Shopping Agent":
self.user_controls["FC_API_KEY"] = st.session_state["FC_API_KEY"] = st.text_input("FC 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)
return self.user_controls
|