Update app.py
Browse files
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
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
def
|
| 42 |
-
|
|
|
|
| 43 |
|
| 44 |
# Create the Gradio interface
|
| 45 |
with gr.Blocks() as demo:
|
| 46 |
markdown_output = gr.Markdown()
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 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()
|