freddyaboulton HF Staff commited on
Commit
f719f9d
·
verified ·
1 Parent(s): 98109f7

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +7 -7
  2. requirements.txt +2 -0
  3. run.ipynb +1 -0
  4. run.py +22 -0
README.md CHANGED
@@ -1,12 +1,12 @@
 
1
  ---
2
- title: Copy Events Main
3
- emoji: 🌖
4
- colorFrom: green
5
- colorTo: pink
6
  sdk: gradio
7
  sdk_version: 5.6.0
8
- app_file: app.py
9
  pinned: false
 
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+
2
  ---
3
+ title: copy_events_main
4
+ emoji: 🔥
5
+ colorFrom: indigo
6
+ colorTo: indigo
7
  sdk: gradio
8
  sdk_version: 5.6.0
9
+ app_file: run.py
10
  pinned: false
11
+ hf_oauth: true
12
  ---
 
 
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio-client @ git+https://github.com/gradio-app/gradio@e7629f7eacdc2a8960fae7472669b60405a4a06c#subdirectory=client/python
2
+ https://gradio-pypi-previews.s3.amazonaws.com/e7629f7eacdc2a8960fae7472669b60405a4a06c/gradio-5.6.0-py3-none-any.whl
run.ipynb ADDED
@@ -0,0 +1 @@
 
 
1
+ {"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: copy_events"]}, {"cell_type": "code", "execution_count": null, "id": "272996653310673477252411125948039410165", "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": "288918539441861185822528903084949547379", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "md = \"This is **bold** text.\"\n", "\n", "def copy_callback(copy_data: gr.CopyData):\n", " return copy_data.value\n", "\n", "with gr.Blocks() as demo:\n", " textbox = gr.Textbox(label=\"Copied text\")\n", " with gr.Row():\n", " markdown = gr.Markdown(value=md, header_links=True, height=400, show_copy_button=True)\n", " chatbot = gr.Chatbot([(\"Hello\", \"World\"), (\"Goodbye\", \"World\")], show_copy_button=True)\n", " textbox2 = gr.Textbox(\"Write something here\", interactive=True, show_copy_button=True)\n", "\n", " gr.on(\n", " [markdown.copy, chatbot.copy, textbox2.copy],\n", " copy_callback,\n", " outputs=textbox\n", " )\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
run.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ md = "This is **bold** text."
4
+
5
+ def copy_callback(copy_data: gr.CopyData):
6
+ return copy_data.value
7
+
8
+ with gr.Blocks() as demo:
9
+ textbox = gr.Textbox(label="Copied text")
10
+ with gr.Row():
11
+ markdown = gr.Markdown(value=md, header_links=True, height=400, show_copy_button=True)
12
+ chatbot = gr.Chatbot([("Hello", "World"), ("Goodbye", "World")], show_copy_button=True)
13
+ textbox2 = gr.Textbox("Write something here", interactive=True, show_copy_button=True)
14
+
15
+ gr.on(
16
+ [markdown.copy, chatbot.copy, textbox2.copy],
17
+ copy_callback,
18
+ outputs=textbox
19
+ )
20
+
21
+ if __name__ == "__main__":
22
+ demo.launch()