Spaces:
Runtime error
Runtime error
File size: 724 Bytes
629c076 dd4984c 629c076 6132d52 629c076 6132d52 629c076 6132d52 629c076 6132d52 629c076 6132d52 629c076 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import gradio as gr
import random
import time
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox()
def user(user_message, history):
return "", history + [[user_message, None]]
def bot(history):
bot_message = "The Moon, Earth s only natural satellite and the fifth largest moon in our Solar System, is a celestial body that orbits our planet approximately every 27.3 days."
history[-1][1] = ""
for character in bot_message:
history[-1][1] += character
time.sleep(0.05)
yield history
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
bot, chatbot, chatbot
)
demo.queue()
demo.launch() |