Spaces:
Running
Running
File size: 502 Bytes
9c25291 0916695 9c25291 0916695 842db10 d37f9fc 9c25291 842db10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import gradio as gr
def store_message(message: str, history: list[str]): # type: ignore
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()],
api_name="predict"
)
if __name__ == "__main__":
demo.launch()
|