File size: 393 Bytes
0b75c79 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import gradio as gr
def store_message(message: str, history: list[str]):
output = {
"Current messages": message,
"Previous messages": history[::-1]
}
history.append(message)
return output, history
demo = gr.Interface(fn=store_message,
inputs=["textbox", gr.State(value=[])],
outputs=["json", gr.State()])
demo.launch() |