Skip to content

Commit

Permalink
Use new SDK; fix state warnings (#51)
Browse files Browse the repository at this point in the history
* reapply new sdk

* bump sdk, get rid of provider radio index

* fixup session state
  • Loading branch information
x5a authored Oct 22, 2024
1 parent b19456c commit 84ebb79
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 84ebb79

Please sign in to comment.