Spaces:
Sleeping
Sleeping
File size: 2,629 Bytes
10231de 7ddd05c ac85c1d 4583e4d ac85c1d 4583e4d ac85c1d 10231de |
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
import streamlit as st
from configfile import Config # Import the Config class
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'] == "RAG Chat":
st.session_state["docs_path"] = st.text_input("Enter Docs path or filename")
if self.user_controls['selected_usecase'] == "Teachable Agent":
selected_chat_purpose = st.selectbox("Do you want me to ask or teach?",
("Ask", "Teach"))
if selected_chat_purpose == "Ask":
st.session_state["Chat_Purpose"]=True
else :
st.session_state["Chat_Purpose"]=False
else:
if st.sidebar.toggle("Chat With History"):
st.session_state["chat_with_history"]=False
else :
st.session_state["chat_with_history"]=True
if st.sidebar.toggle("LLM Caching"):
st.session_state["Cache_Seed"]=True
else :
st.session_state["Cache_Seed"]=False
if self.user_controls['selected_usecase'] == "With LLamaIndex Tool":
st.subheader("ποΈ Trip Advisor Specialist using wikipedia")
return self.user_controls
|