Spaces:
Runtime error
Runtime error
File size: 933 Bytes
4200710 |
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 26 27 28 29 30 31 32 33 |
import gradio as gr
with gr.Blocks() as demo:
history = gr.State([])
user_question = gr.State("")
output_file_name = "chat_history.json"
def slow_echo(message, history):
for i in range(len(message)):
yield "You typed: " + message[: i+1]
def generate_json(history):
pass
chatbox = gr.ChatInterface(
fn=slow_echo,
examples=["How can I help you?"],
title="Title Here",
description="Description for the task",
submit_btn="Enter",
stop_btn="Stop generating",
retry_btn="Regenerate",
undo_btn="Undo last message",
clear_btn="Start a new conversation"
)
chatbox.queue()
json_gen_btn = gr.Button("📩 Download the JSON file for your chat history!")
chat_history_json = []
json_gen_btn.click(fn=generate_json, inputs=history, outputs=chat_history_json)
demo.queue()
demo.launch() |