Spaces:
Build error
Build error
Ben Burtenshaw
commited on
Commit
·
28059a5
1
Parent(s):
218b544
save for later button
Browse files
utils.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
from textwrap import dedent
|
| 2 |
|
| 3 |
import streamlit as st
|
|
@@ -31,8 +32,10 @@ def project_sidebar():
|
|
| 31 |
st.session_state["project_name"] = project_name
|
| 32 |
st.session_state["hub_username"] = hub_username
|
| 33 |
st.session_state["hub_token"] = st.sidebar.text_input(
|
| 34 |
-
"Hub Token", type="password", value=
|
| 35 |
)
|
|
|
|
|
|
|
| 36 |
st.sidebar.link_button(
|
| 37 |
"🤗 Get your Hub Token", "https://huggingface.co/settings/tokens"
|
| 38 |
)
|
|
|
|
| 1 |
+
import os
|
| 2 |
from textwrap import dedent
|
| 3 |
|
| 4 |
import streamlit as st
|
|
|
|
| 32 |
st.session_state["project_name"] = project_name
|
| 33 |
st.session_state["hub_username"] = hub_username
|
| 34 |
st.session_state["hub_token"] = st.sidebar.text_input(
|
| 35 |
+
"Hub Token", type="password", value=os.environ.get("HF_TOKEN")
|
| 36 |
)
|
| 37 |
+
if st.checkbox("Save Hub Token") and st.session_state["hub_token"] is not None:
|
| 38 |
+
os.environ["HF_TOKEN"] = st.session_state["hub_token"]
|
| 39 |
st.sidebar.link_button(
|
| 40 |
"🤗 Get your Hub Token", "https://huggingface.co/settings/tokens"
|
| 41 |
)
|