Drew Skillman
commited on
Commit
·
eb639f2
1
Parent(s):
a6de0c8
point this spaces project to the correct app.py launcher
Browse files- README.md +1 -1
- src/app.py +0 -168
README.md
CHANGED
@@ -5,7 +5,7 @@ colorFrom: purple
|
|
5 |
colorTo: pink
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.45.0
|
8 |
-
app_file:
|
9 |
pinned: false
|
10 |
---
|
11 |
|
|
|
5 |
colorTo: pink
|
6 |
sdk: streamlit
|
7 |
sdk_version: 1.45.0
|
8 |
+
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
11 |
|
src/app.py
DELETED
@@ -1,168 +0,0 @@
|
|
1 |
-
import os
|
2 |
-
import streamlit as st
|
3 |
-
from anthropic import Anthropic
|
4 |
-
from dotenv import load_dotenv
|
5 |
-
|
6 |
-
# Load environment variables
|
7 |
-
load_dotenv()
|
8 |
-
|
9 |
-
# Configure Streamlit page settings
|
10 |
-
st.set_page_config(
|
11 |
-
page_title="Attachment Style Roleplay Simulator",
|
12 |
-
page_icon="🎭",
|
13 |
-
layout="centered",
|
14 |
-
)
|
15 |
-
|
16 |
-
# Initialize Anthropic client
|
17 |
-
anthropic = Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY") or os.getenv("ANTHROPIC_KEY"))
|
18 |
-
|
19 |
-
# Initialize session state for form inputs if not present
|
20 |
-
if "setup_complete" not in st.session_state:
|
21 |
-
st.session_state.setup_complete = False
|
22 |
-
|
23 |
-
if "messages" not in st.session_state:
|
24 |
-
st.session_state.messages = []
|
25 |
-
|
26 |
-
# Main page header
|
27 |
-
st.markdown("<h1 style='text-align: center; color: #333;'>Attachment Style Roleplay Simulator</h1>", unsafe_allow_html=True)
|
28 |
-
st.markdown("<p style='text-align: center; font-size: 18px; color: #555; margin-bottom: 1em;'>A Safe Space for Practicing Difficult Conversations</p>", unsafe_allow_html=True)
|
29 |
-
|
30 |
-
# Welcome text and instructions
|
31 |
-
if not st.session_state.setup_complete:
|
32 |
-
st.markdown("""
|
33 |
-
## Practice Hard Conversations—Safely.
|
34 |
-
|
35 |
-
Welcome to a therapeutic roleplay simulator built for emotionally charged moments.
|
36 |
-
This tool helps you rehearse boundary-setting and difficult conversations by simulating realistic relational dynamics—tailored to your attachment style.
|
37 |
-
|
38 |
-
You'll choose:
|
39 |
-
|
40 |
-
- A scenario (e.g., "Ask my mom not to comment on my body")
|
41 |
-
- A tone of response (e.g., supportive, guilt-tripping, dismissive)
|
42 |
-
- Your attachment style (e.g., anxious, avoidant, disorganized)
|
43 |
-
- And your goal (e.g., "I want to stay calm and not backtrack")
|
44 |
-
|
45 |
-
The AI will take on the role of a realistic human responder—not to therapize you, but to mirror the relational pressure you might encounter in real life. Then, you'll get a reflection summary to help you track your emotional patterns and practice courage.
|
46 |
-
|
47 |
-
### 🧠 Not sure what your attachment style is?
|
48 |
-
You can take this [free quiz from Sarah Peyton](https://www.yourresonantself.com/attachment-assessment) to learn more.
|
49 |
-
Or you can just pick the one that vibes when you read it:
|
50 |
-
|
51 |
-
- **Anxious** – "I often worry if I've upset people or said too much."
|
52 |
-
- **Avoidant** – "I'd rather handle things alone than depend on others."
|
53 |
-
- **Disorganized** – "I want closeness, but I also feel overwhelmed or mistrusting."
|
54 |
-
- **Secure** – "I can handle conflict and connection without losing myself."
|
55 |
-
""")
|
56 |
-
|
57 |
-
# Sidebar with setup form
|
58 |
-
with st.sidebar:
|
59 |
-
st.markdown("""
|
60 |
-
### Welcome! 👋
|
61 |
-
|
62 |
-
Hi, I'm Jocelyn Skillman, LMHC — a clinical therapist, relational design ethicist, and creator of experimental tools that explore how AI can support (not replace) human care.
|
63 |
-
|
64 |
-
Each tool in this collection is thoughtfully designed to:
|
65 |
-
|
66 |
-
- Extend therapeutic support between sessions
|
67 |
-
- Model emotional safety and relational depth
|
68 |
-
- Help clients and clinicians rehearse courage, regulation, and repair
|
69 |
-
- Stay grounded in trauma-informed, developmentally sensitive frameworks
|
70 |
-
|
71 |
-
I use Claude (by Anthropic) as the primary language model for these tools, chosen for its relational tone, contextual nuance, and responsiveness to emotionally complex prompts.
|
72 |
-
|
73 |
-
As a practicing therapist, I imagine these resources being especially helpful to clinicians like myself — companions in the work of tending to others with insight, warmth, and care.
|
74 |
-
|
75 |
-
#### Connect With Me
|
76 |
-
🌐 [jocelynskillman.com](http://www.jocelynskillman.com)
|
77 |
-
📬 [Substack: Relational Code](https://jocelynskillmanlmhc.substack.com/)
|
78 |
-
|
79 |
-
---
|
80 |
-
""")
|
81 |
-
|
82 |
-
st.markdown("### 🎯 Simulation Setup")
|
83 |
-
|
84 |
-
with st.form("simulation_setup"):
|
85 |
-
attachment_style = st.selectbox(
|
86 |
-
"Your Attachment Style",
|
87 |
-
["Anxious", "Avoidant", "Disorganized", "Secure"],
|
88 |
-
help="Select your attachment style for this practice session"
|
89 |
-
)
|
90 |
-
|
91 |
-
scenario = st.text_area(
|
92 |
-
"Scenario Description",
|
93 |
-
placeholder="Example: I want to tell my dad I can't call every night anymore.",
|
94 |
-
help="Describe the conversation you want to practice"
|
95 |
-
)
|
96 |
-
|
97 |
-
tone = st.text_input(
|
98 |
-
"Desired Tone for AI Response",
|
99 |
-
placeholder="Example: guilt-tripping, dismissive, supportive",
|
100 |
-
help="How should the AI character respond?"
|
101 |
-
)
|
102 |
-
|
103 |
-
practice_goal = st.text_area(
|
104 |
-
"Your Practice Goal",
|
105 |
-
placeholder="Example: staying grounded and not over-explaining",
|
106 |
-
help="What would you like to work on in this conversation?"
|
107 |
-
)
|
108 |
-
|
109 |
-
submit_setup = st.form_submit_button("Start Simulation")
|
110 |
-
|
111 |
-
if submit_setup and scenario and tone and practice_goal:
|
112 |
-
# Create system message with simulation parameters
|
113 |
-
system_message = f"""Attachment Style: {attachment_style}
|
114 |
-
Scenario: {scenario}
|
115 |
-
Tone: {tone}
|
116 |
-
Goal: {practice_goal}
|
117 |
-
|
118 |
-
Remember to stay in character unless the client says 'pause', 'reflect', or 'debrief'.
|
119 |
-
Keep responses under 3 lines unless asked to elaborate."""
|
120 |
-
|
121 |
-
# Reset messages and add system message
|
122 |
-
st.session_state.messages = [{"role": "assistant", "content": "Simulation ready. You can begin the conversation whenever you're ready."}]
|
123 |
-
st.session_state.setup_complete = True
|
124 |
-
st.rerun()
|
125 |
-
|
126 |
-
# Display simulation status
|
127 |
-
if not st.session_state.setup_complete:
|
128 |
-
st.info("👈 Please complete the simulation setup in the sidebar to begin.")
|
129 |
-
else:
|
130 |
-
# Display chat history
|
131 |
-
for message in st.session_state.messages:
|
132 |
-
with st.chat_message(message["role"]):
|
133 |
-
st.markdown(message["content"])
|
134 |
-
|
135 |
-
# User input field
|
136 |
-
if user_prompt := st.chat_input("Type your message here... (or type 'debrief' to end simulation)"):
|
137 |
-
# Add user message to chat history
|
138 |
-
st.session_state.messages.append({"role": "user", "content": user_prompt})
|
139 |
-
|
140 |
-
# Display user message
|
141 |
-
with st.chat_message("user"):
|
142 |
-
st.markdown(user_prompt)
|
143 |
-
|
144 |
-
# Get Claude's response
|
145 |
-
with st.spinner("..."):
|
146 |
-
response = anthropic.messages.create(
|
147 |
-
model="claude-3-opus-20240229",
|
148 |
-
max_tokens=1024,
|
149 |
-
messages=[
|
150 |
-
{"role": m["role"], "content": m["content"]}
|
151 |
-
for m in st.session_state.messages
|
152 |
-
]
|
153 |
-
)
|
154 |
-
|
155 |
-
assistant_response = response.content[0].text
|
156 |
-
|
157 |
-
# Add assistant response to chat history
|
158 |
-
st.session_state.messages.append(
|
159 |
-
{"role": "assistant", "content": assistant_response}
|
160 |
-
)
|
161 |
-
|
162 |
-
# Display assistant response
|
163 |
-
with st.chat_message("assistant"):
|
164 |
-
st.markdown(assistant_response)
|
165 |
-
|
166 |
-
# Footer
|
167 |
-
st.markdown("---")
|
168 |
-
st.markdown("<p style='text-align: center; font-size: 16px; color: #666;'>by <a href='http://www.jocelynskillman.com' target='_blank'>Jocelyn Skillman LMHC</a> - to learn more check out: <a href='https://jocelynskillmanlmhc.substack.com/' target='_blank'>jocelynskillmanlmhc.substack.com</a></p>", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|