File size: 685 Bytes
f719f9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr

md = "This is **bold** text."

def copy_callback(copy_data: gr.CopyData):
    return copy_data.value

with gr.Blocks() as demo:
    textbox = gr.Textbox(label="Copied text")
    with gr.Row():
        markdown = gr.Markdown(value=md, header_links=True, height=400, show_copy_button=True)
        chatbot = gr.Chatbot([("Hello", "World"), ("Goodbye", "World")], show_copy_button=True)
        textbox2 = gr.Textbox("Write something here", interactive=True, show_copy_button=True)

        gr.on(
            [markdown.copy, chatbot.copy, textbox2.copy],
            copy_callback,
            outputs=textbox
        )

if __name__ == "__main__":
    demo.launch()