Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -5,7 +5,7 @@ emoji: 🔥
|
|
| 5 |
colorFrom: indigo
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
-
sdk_version: 6.
|
| 9 |
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
hf_oauth: true
|
|
|
|
| 5 |
colorFrom: indigo
|
| 6 |
colorTo: indigo
|
| 7 |
sdk: gradio
|
| 8 |
+
sdk_version: 6.6.0
|
| 9 |
app_file: run.py
|
| 10 |
pinned: false
|
| 11 |
hf_oauth: true
|
run.ipynb
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: invisible_textbox"]}, {"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", "with gr.Blocks() as demo:\n", " with gr.Tabs():\n", " with gr.Tab(\"Invisible Textbox Demo\"):\n", " textbox = gr.Textbox(visible=False, interactive=True, elem_id=\"test-textbox\")\n", "\n", " make_visible_btn = gr.Button(\"Show\")\n", "
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: invisible_textbox"]}, {"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", "with gr.Blocks() as demo:\n", " with gr.Tabs():\n", " with gr.Tab(\"Invisible Textbox Demo\"):\n", " textbox = gr.Textbox(visible=False, interactive=True, elem_id=\"test-textbox\")\n", "\n", " with gr.Row():\n", " make_visible_btn = gr.Button(\"Show\")\n", " hide = gr.Button(\"Hide\")\n", " make_invisible_btn = gr.Button(\"Make Invisible\")\n", "\n", " def show():\n", " return gr.Textbox(visible=True)\n", " make_visible_btn.click(fn=show, outputs=textbox)\n", " hide.click(lambda: gr.Textbox(visible=False), outputs=textbox)\n", " make_invisible_btn.click(lambda: gr.Textbox(visible=\"hidden\"), outputs=textbox)\n", " with gr.Tab(\"Another Tab\"):\n", " msg = gr.Markdown(\"This is another tab to demonstrate that invisible components work across tabs.\", visible=False)\n", " show_message = gr.Button(\"Show Message\")\n", " show_message.click(lambda: gr.Markdown(visible=True), outputs=msg)\n", " with gr.Tab(\"Third Tab\"):\n", " with gr.Accordion(\"Third Tab Accordion\", open=True, visible=False) as acc:\n", " third_msg = gr.Textbox(label=\"Visible Textbox\", interactive=True, visible=True)\n", " hidden_number = gr.Number(visible=False, label=\"Hidden Number\", value=100, elem_id=\"hidden-number\")\n", " show_number_btn = gr.Button(\"Show Number\")\n", " hide_number_btn = gr.Button(\"Hide Number\")\n", " show_number_btn.click(lambda: gr.Number(visible=True), outputs=hidden_number)\n", " hide_number_btn.click(lambda: gr.Number(visible=False), outputs=hidden_number)\n", "\n", " show_third_message = gr.Button(\"Show Accordion\")\n", " show_third_message.click(lambda: gr.Accordion(visible=True), outputs=acc)\n", " hide_third_message = gr.Button(\"Hide Accordion\")\n", " hide_third_message.click(lambda: gr.Accordion(visible=False), outputs=acc)\n", "if __name__ == \"__main__\":\n", " demo.launch()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
|
@@ -5,12 +5,16 @@ with gr.Blocks() as demo:
|
|
| 5 |
with gr.Tab("Invisible Textbox Demo"):
|
| 6 |
textbox = gr.Textbox(visible=False, interactive=True, elem_id="test-textbox")
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
def show():
|
| 11 |
return gr.Textbox(visible=True)
|
| 12 |
make_visible_btn.click(fn=show, outputs=textbox)
|
| 13 |
hide.click(lambda: gr.Textbox(visible=False), outputs=textbox)
|
|
|
|
| 14 |
with gr.Tab("Another Tab"):
|
| 15 |
msg = gr.Markdown("This is another tab to demonstrate that invisible components work across tabs.", visible=False)
|
| 16 |
show_message = gr.Button("Show Message")
|
|
|
|
| 5 |
with gr.Tab("Invisible Textbox Demo"):
|
| 6 |
textbox = gr.Textbox(visible=False, interactive=True, elem_id="test-textbox")
|
| 7 |
|
| 8 |
+
with gr.Row():
|
| 9 |
+
make_visible_btn = gr.Button("Show")
|
| 10 |
+
hide = gr.Button("Hide")
|
| 11 |
+
make_invisible_btn = gr.Button("Make Invisible")
|
| 12 |
+
|
| 13 |
def show():
|
| 14 |
return gr.Textbox(visible=True)
|
| 15 |
make_visible_btn.click(fn=show, outputs=textbox)
|
| 16 |
hide.click(lambda: gr.Textbox(visible=False), outputs=textbox)
|
| 17 |
+
make_invisible_btn.click(lambda: gr.Textbox(visible="hidden"), outputs=textbox)
|
| 18 |
with gr.Tab("Another Tab"):
|
| 19 |
msg = gr.Markdown("This is another tab to demonstrate that invisible components work across tabs.", visible=False)
|
| 20 |
show_message = gr.Button("Show Message")
|