circulartext commited on
Commit
2d4f840
1 Parent(s): 89b5f98

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -10
app.py CHANGED
@@ -13,6 +13,15 @@ st.markdown(
13
  max-width: 90vw; /* Adjust the value as needed */
14
  font-size: 38px;
15
  }
 
 
 
 
 
 
 
 
 
16
  </style>
17
  """,
18
  unsafe_allow_html=True
@@ -195,20 +204,19 @@ Benshiro nodded, his mind already diving back into the problem at hand. Well, y
195
  # Main content area
196
  st.write("This is a Streamlit app where the text appears as if it's being typed like an A.I.")
197
 
198
- # Create a placeholder for the typed text
199
- placeholder = st.empty()
 
 
200
 
201
- # Type the text character by character with a typing animation effect
202
  typed_text = ""
203
  for char in text_to_type:
204
  if char == "\n":
205
- typed_text += "\n"
206
- placeholder.markdown(f"<span style='font-size: 25px;'>{typed_text}</span>", unsafe_allow_html=True)
207
- time.sleep(0.5) # Increased delay for line break
208
  else:
209
  typed_text += char
210
- placeholder.markdown(f"<span style='font-size: 25px;'>{typed_text}</span>", unsafe_allow_html=True)
211
- time.sleep(0.07) # Slightly increased typing speed
212
 
213
- # Add a delay after typing is complete
214
- time.sleep(2)
 
 
13
  max-width: 90vw; /* Adjust the value as needed */
14
  font-size: 38px;
15
  }
16
+
17
+
18
+
19
+ .paragraph-container {
20
+ font-size: 25px; /* Adjust the font size as desired */
21
+ max-width: 90vw; /* Adjust the container width as needed */
22
+ background-color: black; /* Set the background color */
23
+ padding: 10px; /* Add some padding for better readability */
24
+ }
25
  </style>
26
  """,
27
  unsafe_allow_html=True
 
204
  # Main content area
205
  st.write("This is a Streamlit app where the text appears as if it's being typed like an A.I.")
206
 
207
+ # Create a container for the paragraph
208
+ paragraph_container = st.markdown("""
209
+ <div class="paragraph-container"></div>
210
+ """, unsafe_allow_html=True)
211
 
212
+ # Type the text character by character
213
  typed_text = ""
214
  for char in text_to_type:
215
  if char == "\n":
216
+ typed_text += "<br>" # Use <br> for line breaks in HTML
 
 
217
  else:
218
  typed_text += char
 
 
219
 
220
+ # Update the paragraph container with the typed text
221
+ paragraph_container.markdown(typed_text, unsafe_allow_html=True)
222
+ time.sleep(0.05) # Adjust the typing speed as needed