|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import streamlit as st |
|
from streamlit_chat import message |
|
|
|
from appzoo.streamlit_app.utils import reply4input |
|
|
|
if __name__ == '__main__': |
|
def display_previous_message(texts=None): |
|
if texts: |
|
for msg in texts: |
|
message(msg, avatar_style="bottts") |
|
|
|
|
|
display_previous_message(["你好!我是你的电影小助手,很高兴为您服务。", "你可以向我提问。"]) |
|
|
|
container = st.container() |
|
text = st.text_area(label="用户输入", height=100, placeholder="请在这儿输入您的问题") |
|
|
|
if st.button("发送", key="predict"): |
|
with st.spinner("AI正在思考,请稍等........"): |
|
history = st.session_state.get('state') |
|
st.session_state["state"] = reply4input(text, history, container=container) |
|
|