|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import wenxin_api |
|
from wenxin_api.tasks.text_to_image import TextToImage |
|
|
|
import streamlit as st |
|
import streamlit_authenticator as stauth |
|
from streamlit_authenticator import Authenticate |
|
|
|
|
|
from meutils.pipe import * |
|
|
|
st.set_page_config(page_title="文本标注平台", page_icon=":rainbow:", layout="centered", initial_sidebar_state="auto") |
|
|
|
|
|
admin_password = '123456' |
|
|
|
_ = f""" |
|
credentials: |
|
usernames: |
|
admin: |
|
email: [email protected] |
|
name: admin |
|
password: {stauth.Hasher([admin_password]).generate()[0]} # To be replaced with hashed password |
|
|
|
cookie: |
|
expiry_days: 30 |
|
key: some_signature_key |
|
name: some_cookie_name |
|
preauthorized: |
|
|
|
emails: |
|
- [email protected] |
|
""" |
|
|
|
config = yaml.safe_load(_) |
|
|
|
authenticator = Authenticate( |
|
config['credentials'], |
|
config['cookie']['name'], |
|
config['cookie']['key'], |
|
config['cookie']['expiry_days'], |
|
config['preauthorized'] |
|
) |
|
|
|
name, authentication_status, username = authenticator.login('图像生成系统', 'main') |
|
|
|
if authentication_status: |
|
authenticator.logout('退出', 'sidebar') |
|
st.write('# 图像生成系统') |
|
|
|
elif authentication_status == False: |
|
st.error('Username/password is incorrect') |
|
|
|
|
|
|
|
|