-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello.py
32 lines (27 loc) · 889 Bytes
/
hello.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
import streamlit as st
from streamlit_extras.switch_page_button import switch_page
from streamlit_card import card
st.title("Select a persona to chat with:")
if 'persona' not in st.session_state:
st.session_state['persona'] = {}
def select_persona(name, image):
st.session_state['chat_history'] = []
st.session_state['persona'] = {"name": name, "image": image}
switch_page('chat')
personas = [
{
"title": "Geralt of Rivia",
"image": "https://pbs.twimg.com/profile_images/1214274665427935234/OEmo0ORJ_400x400.jpg"
},
{
"title": "Yoda",
"image": "https://pbs.twimg.com/profile_images/378800000178364430/7057bd6197f8a436006ba6e4bf279564_400x400.jpeg"
}
]
for i in personas:
card(
title=i["title"],
text="",
image=i["image"],
on_click=lambda: select_persona(i["title"], i["image"])
)