Hev832 commited on
Commit
8fdbb44
·
verified ·
1 Parent(s): 5d24592

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -35,21 +35,19 @@ For inquiries or collaboration, feel free to reach out to us through [GitHub](ht
35
  def animate_text():
36
  for i in range(0, len(content), 100):
37
  yield content[:i]
38
- time.sleep(0.1) # Sleep for a while between updates
39
 
40
- # Update the Gradio interface dynamically
41
- def update_text():
42
- return list(animate_text())[-1]
 
43
 
44
  # Create the Gradio interface
45
  with gr.Blocks() as demo:
46
  markdown_output = gr.Markdown()
47
 
48
- def animate():
49
- for part in animate_text():
50
- markdown_output.update(part)
51
- time.sleep(0.1)
52
-
53
- demo.load(fn=animate, inputs=[], outputs=markdown_output)
54
 
 
55
  demo.launch()
 
35
  def animate_text():
36
  for i in range(0, len(content), 100):
37
  yield content[:i]
38
+ time.sleep(0.1) # Sleep for 100ms between updates
39
 
40
+ # Function to update text in the Markdown block
41
+ def animate():
42
+ for part in animate_text():
43
+ yield gr.Markdown.update(value=part)
44
 
45
  # Create the Gradio interface
46
  with gr.Blocks() as demo:
47
  markdown_output = gr.Markdown()
48
 
49
+ # Create a `load` event that triggers the animation
50
+ demo.load(animate, inputs=None, outputs=markdown_output)
 
 
 
 
51
 
52
+ # Launch the Gradio app
53
  demo.launch()