Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,11 +78,14 @@ def animated_text(text, speed=0.05):
|
|
| 78 |
|
| 79 |
for letter in text:
|
| 80 |
displayed_text += letter
|
| 81 |
-
placeholder.markdown(f"""
|
|
|
|
|
|
|
| 82 |
time.sleep(speed)
|
|
|
|
| 83 |
|
| 84 |
# πΉ **Display Animated Welcome Message**
|
| 85 |
-
animated_text("
|
| 86 |
|
| 87 |
|
| 88 |
# Get session ID
|
|
@@ -126,15 +129,18 @@ with chat_container:
|
|
| 126 |
for role, content in st.session_state.messages:
|
| 127 |
with st.chat_message(role):
|
| 128 |
st.markdown(content)
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
st.
|
| 133 |
-
|
| 134 |
-
|
|
|
|
| 135 |
|
| 136 |
-
#
|
| 137 |
-
|
|
|
|
|
|
|
| 138 |
|
| 139 |
# If user submits a message
|
| 140 |
if user_input:
|
|
|
|
| 78 |
|
| 79 |
for letter in text:
|
| 80 |
displayed_text += letter
|
| 81 |
+
placeholder.markdown(f"""
|
| 82 |
+
<h1 style="text-align:center; color: #00D1FF;">{displayed_text} π</h1>
|
| 83 |
+
""", unsafe_allow_html=True) # Corrected f-string formatting
|
| 84 |
time.sleep(speed)
|
| 85 |
+
|
| 86 |
|
| 87 |
# πΉ **Display Animated Welcome Message**
|
| 88 |
+
animated_text(""Conversational AI Data Science Tutor"")
|
| 89 |
|
| 90 |
|
| 91 |
# Get session ID
|
|
|
|
| 129 |
for role, content in st.session_state.messages:
|
| 130 |
with st.chat_message(role):
|
| 131 |
st.markdown(content)
|
| 132 |
+
# "New Chat" button (Right Side of Input Box)
|
| 133 |
+
col1, col2 = st.columns([4, 1])
|
| 134 |
+
with col2:
|
| 135 |
+
if st.button("π New Chat"):
|
| 136 |
+
st.session_state.session_id = str(uuid.uuid4()) # Generate new session
|
| 137 |
+
st.session_state.messages = [] # Clear chat history
|
| 138 |
+
st.rerun() # Refresh the app
|
| 139 |
|
| 140 |
+
# User input at the bottom
|
| 141 |
+
with col1:
|
| 142 |
+
# πΉ **Fixed Bottom User Input**
|
| 143 |
+
user_input = st.text_input("Type your message here:", key="user_message")
|
| 144 |
|
| 145 |
# If user submits a message
|
| 146 |
if user_input:
|