Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,23 +34,7 @@ st.markdown("""
|
|
| 34 |
# Title section
|
| 35 |
st.markdown("<h1 class='title'>E-Commerce Analysis</h1>", unsafe_allow_html=True)
|
| 36 |
|
| 37 |
-
# Example Section
|
| 38 |
-
st.markdown("### Try some example questions:")
|
| 39 |
-
examples = [
|
| 40 |
-
"Show me the top 10 products by sales.",
|
| 41 |
-
"What are the average sales by region?",
|
| 42 |
-
"Give me the monthly sales trend for the last year.",
|
| 43 |
-
]
|
| 44 |
|
| 45 |
-
# Display examples with a button to load them into the chat
|
| 46 |
-
for example in examples:
|
| 47 |
-
if st.button(f"Ask: {example}"):
|
| 48 |
-
# Populate input with example and submit
|
| 49 |
-
st.session_state["chat_input"] = example
|
| 50 |
-
chat_actions()
|
| 51 |
-
|
| 52 |
-
with st.chat_message("assistant"):
|
| 53 |
-
st.write("Hello 👋 How can I help you today?")
|
| 54 |
|
| 55 |
def random_string() -> dict:
|
| 56 |
try:
|
|
@@ -84,6 +68,24 @@ def chat_actions():
|
|
| 84 |
if "chat_history" not in st.session_state:
|
| 85 |
st.session_state["chat_history"] = []
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
st.chat_input("Enter your question", on_submit=chat_actions, key="chat_input")
|
| 88 |
|
| 89 |
for i in st.session_state["chat_history"]:
|
|
|
|
| 34 |
# Title section
|
| 35 |
st.markdown("<h1 class='title'>E-Commerce Analysis</h1>", unsafe_allow_html=True)
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
def random_string() -> dict:
|
| 40 |
try:
|
|
|
|
| 68 |
if "chat_history" not in st.session_state:
|
| 69 |
st.session_state["chat_history"] = []
|
| 70 |
|
| 71 |
+
# Example Section
|
| 72 |
+
st.markdown("### Try some example questions:")
|
| 73 |
+
examples = [
|
| 74 |
+
"Show me the top 10 products by sales.",
|
| 75 |
+
"What are the average sales by region?",
|
| 76 |
+
"Give me the monthly sales trend for the last year.",
|
| 77 |
+
]
|
| 78 |
+
|
| 79 |
+
# Display examples with a button to load them into the chat
|
| 80 |
+
for example in examples:
|
| 81 |
+
if st.button(f"Ask: {example}"):
|
| 82 |
+
# Populate input with example and submit
|
| 83 |
+
st.session_state["chat_input"] = example
|
| 84 |
+
chat_actions()
|
| 85 |
+
|
| 86 |
+
with st.chat_message("assistant"):
|
| 87 |
+
st.write("Hello 👋 How can I help you today?")
|
| 88 |
+
|
| 89 |
st.chat_input("Enter your question", on_submit=chat_actions, key="chat_input")
|
| 90 |
|
| 91 |
for i in st.session_state["chat_history"]:
|