new-space / app.py
drzo's picture
initial commit
9de5a7b verified
raw
history blame contribute delete
542 Bytes
import time
import gradio as gr
# Define a function that streams the message back to the user one character at a time
def slow_echo(message, history):
for i in range(len(message)):
time.sleep(0.05) # Simulate a delay for each character
yield "You typed: " + message[:i + 1] # Yield the message up to the current character
# Create a Gradio ChatInterface with the slow_echo function
demo = gr.ChatInterface(slow_echo, type="messages")
# Launch the Gradio app
if __name__ == "__main__":
demo.launch(show_error=True)