Spaces:
Sleeping
Sleeping
File size: 2,603 Bytes
5cbbfa5 66cd554 5cbbfa5 66cd554 5cbbfa5 66cd554 5cbbfa5 66cd554 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
import streamlit as st
import os
from dotenv import load_dotenv
import google.generativeai as genai
from pathlib import Path
import json
# Load environment variables
load_dotenv()
# Configure Gemini API
genai.configure(api_key=os.getenv("Gemini_API_Key"))
model = genai.GenerativeModel('gemini-pro')
# Page config
st.set_page_config(
page_title="MI Assistant",
page_icon="🧊",
layout="wide",
initial_sidebar_state="expanded"
)
# Initialize session state variables
if 'role' not in st.session_state:
st.session_state.role = None
if 'current_mode' not in st.session_state:
st.session_state.current_mode = None
# Import other modules
from tutorial import show_tutorial
from live_session import show_live_session
from moti_chat import show_moti_chat
from session_analysis import show_session_analysis
def sidebar():
with st.sidebar:
# Role switcher at the top
st.session_state.role = st.radio(
"Switch Role",
["Consumer", "Therapist"],
index=0 if st.session_state.role == "Consumer" else 1
)
st.title("Navigation")
# Tutorial button
if st.button("Tutorial"):
st.session_state.current_mode = "tutorial"
# Main navigation
st.subheader("Main Features")
if st.button("Live Session"):
st.session_state.current_mode = "live_session"
if st.button("Moti Chat"):
st.session_state.current_mode = "moti_chat"
if st.button("Session Analysis"):
st.session_state.current_mode = "session_analysis"
def welcome_page():
st.title("Welcome to MI Assistant")
st.write("Please select your role to continue:")
col1, col2 = st.columns(2)
with col1:
if st.button("I am a Consumer"):
st.session_state.role = "Consumer"
st.session_state.current_mode = "tutorial"
with col2:
if st.button("I am a Therapist"):
st.session_state.role = "Therapist"
st.session_state.current_mode = "tutorial"
def main():
if st.session_state.role is None:
welcome_page()
else:
sidebar()
if st.session_state.current_mode == "tutorial":
show_tutorial()
elif st.session_state.current_mode == "live_session":
show_live_session()
elif st.session_state.current_mode == "moti_chat":
show_moti_chat()
elif st.session_state.current_mode == "session_analysis":
show_session_analysis()
if __name__ == "__main__":
main() |