Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- requirements.txt +2 -2
- run.ipynb +1 -1
- run.py +30 -6
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
gradio-client @ git+https://github.com/gradio-app/gradio@
|
2 |
-
https://gradio-pypi-previews.s3.amazonaws.com/
|
|
|
1 |
+
gradio-client @ git+https://github.com/gradio-app/gradio@6b2bcd097ae5ef999a7fb273ecf7c7e4c0eab305#subdirectory=client/python
|
2 |
+
https://gradio-pypi-previews.s3.amazonaws.com/6b2bcd097ae5ef999a7fb273ecf7c7e4c0eab305/gradio-5.35.0-py3-none-any.whl
|
run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: render_visibility"]}, {"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", "\n", "def greet(name):\n", " return \"Hello \" + name + \"!\"\n", "\n", "\n", "with gr.Blocks() as demo:\n", " with gr.Tabs():\n", " with gr.TabItem(\"Tab 1\"):\n", " t = gr.Textbox(\"Some value\", label=\"Name\", visible=False)\n", "
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: render_visibility"]}, {"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", "\n", "def greet(name):\n", " return \"Hello \" + name + \"!\"\n", "\n", "\n", "with gr.Blocks() as demo:\n", " with gr.Tabs():\n", " with gr.TabItem(\"Tab 1\"):\n", " t = gr.Textbox(\"Some value\", label=\"Name\", visible=False, interactive=True)\n", " with gr.Row():\n", " show_btn = gr.Button(\"Show\")\n", " show_btn.click(lambda: gr.Textbox(visible=True), inputs=None, outputs=t)\n", " hide_btn = gr.Button(\"Hide\")\n", " hide_btn.click(lambda: gr.Textbox(visible=False), inputs=None, outputs=t)\n", "\n", " with gr.TabItem(\"Tab 2\"):\n", " t2 = gr.Textbox(\n", " \"Some other value\", label=\"Name\", visible=False, interactive=True\n", " )\n", " with gr.Row():\n", " show_btn2 = gr.Button(\"Show\")\n", " show_btn2.click(\n", " lambda: gr.Textbox(visible=True), inputs=None, outputs=t2\n", " )\n", " hide_btn2 = gr.Button(\"Hide\")\n", " hide_btn2.click(\n", " lambda: gr.Textbox(visible=False), inputs=None, outputs=t2\n", " )\n", " with gr.TabItem(\"Tab 3\"):\n", " t3 = gr.ImageEditor(label=\"Name\", visible=False, interactive=True)\n", " with gr.Row():\n", " show_btn3 = gr.Button(\"Show\")\n", " show_btn3.click(\n", " lambda: gr.Textbox(visible=True), inputs=None, outputs=t3\n", " )\n", " hide_btn3 = gr.Button(\"Hide\")\n", " hide_btn3.click(\n", " lambda: gr.Textbox(visible=False), inputs=None, outputs=t3\n", " )\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
@@ -8,13 +8,37 @@ def greet(name):
|
|
8 |
with gr.Blocks() as demo:
|
9 |
with gr.Tabs():
|
10 |
with gr.TabItem("Tab 1"):
|
11 |
-
t = gr.Textbox("Some value", label="Name", visible=False)
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
14 |
with gr.TabItem("Tab 2"):
|
15 |
-
t2 = gr.Textbox(
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
if __name__ == "__main__":
|
20 |
demo.launch()
|
|
|
8 |
with gr.Blocks() as demo:
|
9 |
with gr.Tabs():
|
10 |
with gr.TabItem("Tab 1"):
|
11 |
+
t = gr.Textbox("Some value", label="Name", visible=False, interactive=True)
|
12 |
+
with gr.Row():
|
13 |
+
show_btn = gr.Button("Show")
|
14 |
+
show_btn.click(lambda: gr.Textbox(visible=True), inputs=None, outputs=t)
|
15 |
+
hide_btn = gr.Button("Hide")
|
16 |
+
hide_btn.click(lambda: gr.Textbox(visible=False), inputs=None, outputs=t)
|
17 |
+
|
18 |
with gr.TabItem("Tab 2"):
|
19 |
+
t2 = gr.Textbox(
|
20 |
+
"Some other value", label="Name", visible=False, interactive=True
|
21 |
+
)
|
22 |
+
with gr.Row():
|
23 |
+
show_btn2 = gr.Button("Show")
|
24 |
+
show_btn2.click(
|
25 |
+
lambda: gr.Textbox(visible=True), inputs=None, outputs=t2
|
26 |
+
)
|
27 |
+
hide_btn2 = gr.Button("Hide")
|
28 |
+
hide_btn2.click(
|
29 |
+
lambda: gr.Textbox(visible=False), inputs=None, outputs=t2
|
30 |
+
)
|
31 |
+
with gr.TabItem("Tab 3"):
|
32 |
+
t3 = gr.ImageEditor(label="Name", visible=False, interactive=True)
|
33 |
+
with gr.Row():
|
34 |
+
show_btn3 = gr.Button("Show")
|
35 |
+
show_btn3.click(
|
36 |
+
lambda: gr.Textbox(visible=True), inputs=None, outputs=t3
|
37 |
+
)
|
38 |
+
hide_btn3 = gr.Button("Hide")
|
39 |
+
hide_btn3.click(
|
40 |
+
lambda: gr.Textbox(visible=False), inputs=None, outputs=t3
|
41 |
+
)
|
42 |
|
43 |
if __name__ == "__main__":
|
44 |
demo.launch()
|