Spaces:
Sleeping
Sleeping
import streamlit as st | |
import streamlit_authenticator as stauth | |
import yaml | |
from yaml.loader import SafeLoader | |
# Load configuration for authentication | |
with open('config.yaml') as file: | |
config = yaml.load(file, Loader=SafeLoader) | |
authenticator = stauth.Authenticate( | |
config['credentials'], | |
config['cookie']['name'], | |
config['cookie']['key'], | |
config['cookie']['expiry_days'], | |
config['preauthorized'] | |
) | |
st.set_page_config(page_title="Ayurvedic Healthcare Platform", layout="wide") | |
def main(): | |
st.title("AI-Powered Ayurvedic Healthcare Platform") | |
st.write("Welcome to our innovative Ayurvedic wellness platform!") | |
col1, col2 = st.columns(2) | |
with col1: | |
st.subheader("New to our platform?") | |
if st.button("Sign Up"): | |
st.session_state['signup'] = True | |
with col2: | |
st.subheader("Already have an account?") | |
name, authentication_status, username = authenticator.login('Login', 'main') | |
if st.session_state.get('signup', False): | |
with st.form("signup_form"): | |
st.subheader("Sign Up") | |
new_username = st.text_input("Username") | |
new_password = st.text_input("Password", type="password") | |
role = st.selectbox("I am a", ["Patient", "Doctor"]) | |
if st.form_submit_button("Create Account"): | |
# Here you would typically add the new user to your database | |
st.success(f"Account created for {new_username} as a {role}!") | |
if role == "Patient": | |
st.info("You've received $500 USD in your internal wallet.") | |
st.session_state['signup'] = False | |
if st.session_state.get("authentication_status"): | |
authenticator.logout('Logout', 'main') | |
st.write(f'Welcome *{st.session_state["name"]}*') | |
st.info("Please navigate to the appropriate module using the sidebar.") | |
elif st.session_state.get("authentication_status") is False: | |
st.error('Username/password is incorrect') | |
if __name__ == "__main__": | |
main() |