Skip to content

Commit

Permalink
fixup session state
Browse files Browse the repository at this point in the history
  • Loading branch information
x5a committed Oct 22, 2024
1 parent fdd3b43 commit ef9ba63
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions computer-use-demo/computer_use_demo/streamlit.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ def setup_state():
st.session_state.api_key = load_from_storage("api_key") or os.getenv(
"ANTHROPIC_API_KEY", ""
)
if "api_key_input" not in st.session_state:
st.session_state.api_key_input = st.session_state.api_key
if "provider" not in st.session_state:
st.session_state.provider = (
os.getenv("API_PROVIDER", "anthropic") or APIProvider.ANTHROPIC
Expand Down Expand Up @@ -124,14 +122,10 @@ def _reset_api_provider():
if st.session_state.provider == APIProvider.ANTHROPIC:
st.text_input(
"Anthropic API Key",
value=st.session_state.api_key,
type="password",
key="api_key_input",
on_change=lambda: save_to_storage(
"api_key", st.session_state.api_key_input
),
key="api_key",
on_change=lambda: save_to_storage("api_key", st.session_state.api_key),
)
st.session_state.api_key = st.session_state.api_key_input

st.number_input(
"Only send N most recent images",
Expand Down

0 comments on commit ef9ba63

Please # to comment.