wop commited on
Commit
e469a9e
·
verified ·
1 Parent(s): 7cf8d21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -23,11 +23,9 @@ def ask_question(question):
23
  else:
24
  return "Error: Failed to retrieve an answer."
25
 
26
- def animate_typing(text):
27
- animated_text = ""
28
  for char in text:
29
- animated_text += char
30
- st.text("Answer: " + animated_text)
31
  time.sleep(0.05)
32
 
33
  def main():
@@ -41,7 +39,8 @@ def main():
41
  answer_placeholder.write("Thinking...")
42
  answer = ask_question(question)
43
  answer_placeholder.empty()
44
- animate_typing(answer)
 
45
  else:
46
  st.write("Please enter a question.")
47
 
 
23
  else:
24
  return "Error: Failed to retrieve an answer."
25
 
26
+ def animate_typing(text_placeholder, text):
 
27
  for char in text:
28
+ text_placeholder.text("Answer: " + text_placeholder.text + char)
 
29
  time.sleep(0.05)
30
 
31
  def main():
 
39
  answer_placeholder.write("Thinking...")
40
  answer = ask_question(question)
41
  answer_placeholder.empty()
42
+ text_placeholder = st.empty()
43
+ animate_typing(text_placeholder, answer)
44
  else:
45
  st.write("Please enter a question.")
46