Wajahat698 commited on
Commit
cd2bd56
·
verified ·
1 Parent(s): 1e0a34a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +56 -0
app.py CHANGED
@@ -610,7 +610,59 @@ suggestions = [
610
  "Ask what's behind TrustLogic®."
611
  ]
612
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
 
615
  prompt = st.chat_input("")
616
  if prompt :
@@ -622,9 +674,13 @@ if prompt :
622
  # Display user message
623
  with st.chat_message("user"):
624
  st.markdown(prompt)
 
 
 
625
 
626
  # Generate AI response
627
  with st.chat_message("assistant"):
 
628
  full_response = ""
629
 
630
  try:
 
610
  "Ask what's behind TrustLogic®."
611
  ]
612
 
613
+ def add_dot_typing_animation():
614
+ st.markdown(
615
+ """
616
+ <style>
617
+ .dots-container {
618
+ display: flex;
619
+ align-items: center;
620
+ }
621
+
622
+ .dot {
623
+ height: 10px;
624
+ width: 10px;
625
+ margin: 0 5px;
626
+ background-color: #bbb;
627
+ border-radius: 50%;
628
+ display: inline-block;
629
+ animation: dot-blink 1.5s infinite ease-in-out;
630
+ }
631
+
632
+ .dot:nth-child(2) {
633
+ animation-delay: 0.2s;
634
+ }
635
 
636
+ .dot:nth-child(3) {
637
+ animation-delay: 0.4s;
638
+ }
639
+
640
+ @keyframes dot-blink {
641
+ 0% {
642
+ opacity: 0.3;
643
+ }
644
+ 20% {
645
+ opacity: 1;
646
+ }
647
+ 100% {
648
+ opacity: 0.3;
649
+ }
650
+ }
651
+ </style>
652
+ """,
653
+ unsafe_allow_html=True,
654
+ )
655
+
656
+ # Function to display the assistant typing dots
657
+ def display_typing_indicator():
658
+ dot_typing_html = """
659
+ <div class="dots-container">
660
+ <span class="dot"></span>
661
+ <span class="dot"></span>
662
+ <span class="dot"></span>
663
+ </div>
664
+ """
665
+ st.markdown(dot_typing_html, unsafe_allow_html=True)
666
 
667
  prompt = st.chat_input("")
668
  if prompt :
 
674
  # Display user message
675
  with st.chat_message("user"):
676
  st.markdown(prompt)
677
+ with st.chat_message("assistant"):
678
+ add_dot_typing_animation()
679
+ display_typing_indicator()
680
 
681
  # Generate AI response
682
  with st.chat_message("assistant"):
683
+
684
  full_response = ""
685
 
686
  try: