Spaces:
Sleeping
Sleeping
File size: 1,868 Bytes
ed65c68 2bdc2ca ed65c68 2bdc2ca ed65c68 |
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 |
import streamlit as st
from blogGenerator.ui.uiconfigfile import Config
class LoadStreamlitUI:
def __init__(self):
self.config = Config()
self.user_controls = {}
def initialize_session(self):
return {
"current_step": "requirements",
}
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())
# st.session_state.timeframe = ""
# st.session_state.IsFetchButtonClicked = False
# st.session_state.IsSDLC = False
with st.sidebar:
# Get options from config
llm_options = self.config.get_llm_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",
)
# Validate API key
if not self.user_controls["GROQ_API_KEY"]:
st.warning(
"โ ๏ธ Please enter your GROQ API key to proceed. Don't have? refer : https://console.groq.com/keys "
)
if "state" not in st.session_state:
st.session_state.state = self.initialize_session()
return self.user_controls
|