Spaces:
Sleeping
Sleeping
Commit
·
d657219
1
Parent(s):
0cd2128
Add logo to log-in
Browse files- .streamlit/config.toml +4 -1
- app.py +14 -0
- media/gravity_logo.svg +1 -0
.streamlit/config.toml
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
[client]
|
| 2 |
-
showSidebarNavigation = false
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
[client]
|
| 2 |
+
showSidebarNavigation = false
|
| 3 |
+
|
| 4 |
+
[theme]
|
| 5 |
+
base="light"
|
app.py
CHANGED
|
@@ -9,6 +9,7 @@ import hmac
|
|
| 9 |
import pandas as pd
|
| 10 |
|
| 11 |
# Custom and other imports
|
|
|
|
| 12 |
# from utils import add_logo
|
| 13 |
from menu import menu
|
| 14 |
|
|
@@ -29,12 +30,16 @@ if "role" not in st.session_state:
|
|
| 29 |
|
| 30 |
# From https://stackoverflow.com/questions/55961295/serviceaccountcredentials-from-json-keyfile-name-equivalent-for-remote-json
|
| 31 |
# See also https://www.slingacademy.com/article/pandas-how-to-read-and-update-google-sheet-files/
|
|
|
|
|
|
|
|
|
|
| 32 |
def create_keyfile_dict():
|
| 33 |
variables_keys = {
|
| 34 |
# "spreadsheet": st.secrets['spreadsheet'], # spreadsheet
|
| 35 |
"type": st.secrets['type'], # type
|
| 36 |
"project_id": st.secrets['project_id'], # project_id
|
| 37 |
"private_key_id": st.secrets['private_key_id'], # private_key_id
|
|
|
|
| 38 |
"private_key": st.secrets['private_key'], # private_key
|
| 39 |
"client_email": st.secrets['client_email'], # client_email
|
| 40 |
"client_id": st.secrets['client_id'], # client_id
|
|
@@ -52,6 +57,15 @@ def check_password():
|
|
| 52 |
|
| 53 |
def login_form():
|
| 54 |
"""Form with widgets to collect user information"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
with st.form("Credentials"):
|
| 56 |
st.text_input("Username", key="username")
|
| 57 |
st.text_input("Password", type="password", key="password")
|
|
|
|
| 9 |
import pandas as pd
|
| 10 |
|
| 11 |
# Custom and other imports
|
| 12 |
+
import project_config
|
| 13 |
# from utils import add_logo
|
| 14 |
from menu import menu
|
| 15 |
|
|
|
|
| 30 |
|
| 31 |
# From https://stackoverflow.com/questions/55961295/serviceaccountcredentials-from-json-keyfile-name-equivalent-for-remote-json
|
| 32 |
# See also https://www.slingacademy.com/article/pandas-how-to-read-and-update-google-sheet-files/
|
| 33 |
+
# See also https://docs.streamlit.io/develop/tutorials/databases/private-gsheet
|
| 34 |
+
# Note that the secrets cannot be passed in a group in HuggingFace Spaces,
|
| 35 |
+
# which is required for the native Streamlit implementation
|
| 36 |
def create_keyfile_dict():
|
| 37 |
variables_keys = {
|
| 38 |
# "spreadsheet": st.secrets['spreadsheet'], # spreadsheet
|
| 39 |
"type": st.secrets['type'], # type
|
| 40 |
"project_id": st.secrets['project_id'], # project_id
|
| 41 |
"private_key_id": st.secrets['private_key_id'], # private_key_id
|
| 42 |
+
# Have to replace \n with new lines (^l in Word) by hand
|
| 43 |
"private_key": st.secrets['private_key'], # private_key
|
| 44 |
"client_email": st.secrets['client_email'], # client_email
|
| 45 |
"client_id": st.secrets['client_id'], # client_id
|
|
|
|
| 57 |
|
| 58 |
def login_form():
|
| 59 |
"""Form with widgets to collect user information"""
|
| 60 |
+
# Header
|
| 61 |
+
col1, col2, col3 = st.columns(3)
|
| 62 |
+
with col2:
|
| 63 |
+
st.image(str(project_config.MEDIA_DIR / 'gravity_logo.svg'), width=300)
|
| 64 |
+
|
| 65 |
+
# col1, col2, col3 = st.columns(3)
|
| 66 |
+
# with col1:
|
| 67 |
+
# st.header("Log In")
|
| 68 |
+
|
| 69 |
with st.form("Credentials"):
|
| 70 |
st.text_input("Username", key="username")
|
| 71 |
st.text_input("Password", type="password", key="password")
|
media/gravity_logo.svg
ADDED
|
|