File size: 3,238 Bytes
cff1e0e |
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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
import streamlit as st
# Page configuration
st.set_page_config(
page_title="Therapist Conversation Evaluator",
page_icon="🧠",
layout="wide"
)
# Custom CSS for better styling
st.markdown("""
<style>
.main-header {
font-size: 2.5rem;
color: #1f77b4;
text-align: center;
margin-bottom: 2rem;
}
.metric-card {
background-color: #f0f2f6;
padding: 1rem;
border-radius: 0.5rem;
margin: 0.5rem 0;
}
.utterance-box {
background-color: #f8f9fa;
padding: 1rem;
border-left: 4px solid #1f77b4;
margin: 0.5rem 0;
}
.step-indicator {
font-weight: bold;
padding: 0.5rem;
border-radius: 0.5rem;
}
.stButton > button {
width: 100%;
border-radius: 0.5rem;
padding: 0.5rem 1rem;
font-weight: 500;
transition: all 0.3s;
}
.stButton > button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
[data-testid="stFileUploader"] {
border: 2px dashed #1f77b4;
border-radius: 0.5rem;
padding: 2rem;
}
</style>
""", unsafe_allow_html=True)
def main():
st.markdown('<h1 class="main-header">🧠 Therapist Conversation Evaluator</h1>', unsafe_allow_html=True)
st.markdown("""
This tool evaluates therapist-patient conversations using multiple LLM models to provide
comprehensive metrics including empathy, clarity, therapeutic alliance, and more.
""")
# Initialize session state
if 'orchestrator' not in st.session_state:
from services.orchestrator import ConversationOrchestrator
st.session_state.orchestrator = ConversationOrchestrator()
if 'step' not in st.session_state:
st.session_state.step = 1
if 'selected_metrics' not in st.session_state:
st.session_state.selected_metrics = []
if 'selected_model' not in st.session_state:
st.session_state.selected_model = None
if 'conversation_uploaded' not in st.session_state:
st.session_state.conversation_uploaded = False
if 'utterances' not in st.session_state:
st.session_state.utterances = []
# Progress indicator
steps = ["1️⃣ API Keys", "2️⃣ Upload File", "3️⃣ Select Metrics", "4️⃣ View Results"]
current_step = st.session_state.step
# Create progress bars
cols = st.columns(4)
for i, (col, step_name) in enumerate(zip(cols, steps)):
with col:
if i + 1 < current_step:
st.success(step_name)
elif i + 1 == current_step:
st.info(step_name)
else:
st.write(step_name)
st.divider()
# Render the appropriate step
if current_step == 1:
from pages.step1 import render_step1
render_step1()
elif current_step == 2:
from pages.step2 import render_step2
render_step2()
elif current_step == 3:
from pages.step3 import render_step3
render_step3()
elif current_step == 4:
from pages.step4 import render_step4
render_step4()
if __name__ == "__main__":
main()
|