Benjamin Consolvo commited on
Commit
9b804ec
·
1 Parent(s): 2ce7cb5

fix selected model error

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -23,11 +23,11 @@ with st.sidebar:
23
  if "selected_model" not in st.session_state:
24
  st.session_state.selected_model = default_model_name if default_model_name in model_names else model_names[0]
25
 
 
26
  modelname = st.selectbox(
27
  "Select an LLM model (Running on Intel® Gaudi®). Hosted on Denvr Dataworks",
28
  model_names,
29
- index=model_names.index(st.session_state.selected_model) if st.session_state.selected_model in model_names else 0,
30
- key="selected_model",
31
  )
32
  st.write(f"You selected: {modelname}")
33
  st.button("Start New Chat", on_click=clear_chat)
 
23
  if "selected_model" not in st.session_state:
24
  st.session_state.selected_model = default_model_name if default_model_name in model_names else model_names[0]
25
 
26
+ # Create the selectbox without the `index` parameter
27
  modelname = st.selectbox(
28
  "Select an LLM model (Running on Intel® Gaudi®). Hosted on Denvr Dataworks",
29
  model_names,
30
+ key="selected_model", # This ties the widget to st.session_state["selected_model"]
 
31
  )
32
  st.write(f"You selected: {modelname}")
33
  st.button("Start New Chat", on_click=clear_chat)