Benjamin Consolvo commited on
Commit
3dc90a2
·
1 Parent(s): caad47f

store selected model

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -27,7 +27,16 @@ with st.sidebar:
27
  models = client.models.list()
28
  model_names = [model.id for model in models] # Extract 'id' from each model object
29
 
30
- modelname = st.selectbox("Select LLM model (Running on Intel® Gaudi®) on Denvr Dataworks", model_names)
 
 
 
 
 
 
 
 
 
31
  st.write(f"You selected: {modelname}")
32
  st.button("Start New Chat", on_click=clear_chat)
33
 
 
27
  models = client.models.list()
28
  model_names = [model.id for model in models] # Extract 'id' from each model object
29
 
30
+ # Use st.session_state to persist the selected model
31
+ if "selected_model" not in st.session_state:
32
+ st.session_state.selected_model = model_names[0] # Default to the first model
33
+
34
+ modelname = st.selectbox(
35
+ "Select LLM model (Running on Intel® Gaudi®) on Denvr Dataworks",
36
+ model_names,
37
+ index=model_names.index(st.session_state.selected_model) if st.session_state.selected_model in model_names else 0,
38
+ key="selected_model",
39
+ )
40
  st.write(f"You selected: {modelname}")
41
  st.button("Start New Chat", on_click=clear_chat)
42