Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,10 +91,18 @@ if prompt := st.chat_input("How can I help you?"):
|
|
| 91 |
with st.chat_message("assistant"):
|
| 92 |
message_placeholder = st.empty()
|
| 93 |
typing_placeholder = st.empty()
|
| 94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
full_response = ""
|
| 96 |
response = get_completion(prompt, merged_model, tokenizer)
|
| 97 |
-
typing_placeholder.empty()
|
| 98 |
|
| 99 |
# Simulate stream of responses with milliseconds delay
|
| 100 |
for chunk in response.split():
|
|
|
|
| 91 |
with st.chat_message("assistant"):
|
| 92 |
message_placeholder = st.empty()
|
| 93 |
typing_placeholder = st.empty()
|
| 94 |
+
typing_dots = "" # Initialize empty string for typing dots
|
| 95 |
+
|
| 96 |
+
# Animate typing dots
|
| 97 |
+
for i in range(3):
|
| 98 |
+
typing_dots += "."
|
| 99 |
+
typing_placeholder.markdown(typing_dots)
|
| 100 |
+
time.sleep(0.3) # Adjust speed as needed
|
| 101 |
+
|
| 102 |
+
typing_placeholder.empty() # Clear typing dots
|
| 103 |
+
|
| 104 |
full_response = ""
|
| 105 |
response = get_completion(prompt, merged_model, tokenizer)
|
|
|
|
| 106 |
|
| 107 |
# Simulate stream of responses with milliseconds delay
|
| 108 |
for chunk in response.split():
|