forked from BuddhiGamage/questacon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
118 lines (103 loc) · 3.46 KB
/
app.py
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
117
118
import streamlit as st
from connection import Connection
# Play an animation
def animation(button_name):
st.session_state.behavior_mng_service.stopAllBehaviors()
st.session_state.behavior_mng_service.startBehavior("questacon/"+button_name)
#creating the connection
if 'pepper' not in st.session_state:
st.session_state.pepper = Connection()
ip='localhost'
# ip='127.0.0.1'
port=42535
# ip='10.0.0.244'
# ip='192.168.1.53'
# port=9559
st.session_state.session = st.session_state.pepper.connect(ip, port)
# Create a proxy to the AL services
st.session_state.behavior_mng_service = st.session_state.session.service("ALBehaviorManager")
# UI layout
st.markdown("<h1 style='text-align: center;'>Questacon App</h1>", unsafe_allow_html=True)
col1, col2 = st.columns([3,1])
with col1:
st.header("Interactive Actions with Pepper")
st.text("Click any button below to see Pepper in action:")
with col2:
st.write("")
st.write("")
st.write("")
if st.button("\nStop Animation\n", type="primary"): # Create the button
st.session_state.behavior_mng_service.stopAllBehaviors()
animation("stand")
st.success("Button pressed...")
# Apply CSS to ensure buttons have the same width
st.markdown("""
<style>
.stButton button {
width: 100%;
margin-bottom: 10px;
}
</style>
""", unsafe_allow_html=True)
st.subheader("Dialog Animations")
# Create two columns for the 7 buttons
col1, col2 = st.columns(2)
with col1:
if st.button("Space & time"):
animation("space_and_time")
st.success("Button pressed...")
if st.button("Self & others"):
animation("self_and_others")
st.success("Button pressed...")
if st.button("Affirmation"):
animation("affirmation")
st.success("Button pressed...")
if st.button("Negation"):
animation("negation")
st.success("Button pressed...")
with col2:
if st.button("Question"):
animation("question")
st.success("Button pressed...")
if st.button("Exclamation"):
animation("exclamation")
st.success("Button pressed...")
if st.button("Enumeration"):
animation("enumeration")
st.success("Button pressed...")
st.subheader("Moods")
# Create two columns for the 9 buttons
col1, col2, col3 = st.columns(3)
with col1:
st.markdown("<h3 style='text-align: center;'>Positive</h3>", unsafe_allow_html=True)
if st.button("Happy"):
animation("happy")
st.success("Button pressed...")
if st.button("Kisses"):
animation("kisses")
st.success("Button pressed...")
if st.button("Excited"):
animation("excited")
st.success("Button pressed...")
with col2:
st.markdown("<h3 style='text-align: center;'>Neutral</h3>", unsafe_allow_html=True)
if st.button("Thinking"):
animation("thinking")
st.success("Button pressed...")
if st.button("Curious"):
animation("curious")
st.success("Button pressed...")
if st.button("Chill"):
animation("chill")
st.success("Button pressed...")
with col3:
st.markdown("<h3 style='text-align: center;'>Negative</h3>", unsafe_allow_html=True)
if st.button("Fear"):
animation("fear")
st.success("Button pressed...")
if st.button("Confused"):
animation("confused")
st.success("Button pressed...")
if st.button("Bored"):
animation("bored")
st.success("Button pressed...")