mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
e7629f7eac
* add copy event * add changeset * test * demo * changes * add changeset * add list format * typing * notebook * copy events' --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
23 lines
685 B
Python
23 lines
685 B
Python
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()
|