Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from datetime import datetime, time
|
2 |
import streamlit as st
|
|
|
3 |
|
4 |
|
5 |
st.title("Streamlit App at Hugging Face Spaces!")
|
@@ -44,3 +45,21 @@ with st.sidebar:
|
|
44 |
value=datetime(2020, 1, 1, 9, 30),
|
45 |
format="MM/DD/YY - hh:mm")
|
46 |
st.write("Start time:", start_time)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from datetime import datetime, time
|
2 |
import streamlit as st
|
3 |
+
import numpy as np
|
4 |
|
5 |
|
6 |
st.title("Streamlit App at Hugging Face Spaces!")
|
|
|
45 |
value=datetime(2020, 1, 1, 9, 30),
|
46 |
format="MM/DD/YY - hh:mm")
|
47 |
st.write("Start time:", start_time)
|
48 |
+
|
49 |
+
|
50 |
+
if "chat_messages" not in st.session_state:
|
51 |
+
st.session_state.chat_messages = []
|
52 |
+
|
53 |
+
prompt = st.chat_input("Say something")
|
54 |
+
if prompt:
|
55 |
+
st.session_state.chat_messages.append({"type": "user", "message": prompt})
|
56 |
+
st.session_state.chat_messages.append({"type": "bot", "message": "Hello!", "chart": np.random.randn(30, 3)})
|
57 |
+
|
58 |
+
for message in st.session_state.chat_messages[::-1]:
|
59 |
+
if message["type"] == "user":
|
60 |
+
with st.chat_message("You"):
|
61 |
+
st.write(message["message"])
|
62 |
+
else:
|
63 |
+
with st.chat_message("Bot"):
|
64 |
+
st.write(message["message"])
|
65 |
+
st.line_chart(message["chart"])
|