Spaces:
Running
Running
Upload with huggingface_hub
Browse files- requirements.txt +1 -1
- run.ipynb +1 -1
- run.py +6 -3
requirements.txt
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
|
2 |
-
https://gradio-main-build.s3.amazonaws.com/
|
|
|
1 |
|
2 |
+
https://gradio-main-build.s3.amazonaws.com/94c9512df92f74d33a67f81f52962ad7a3e85dfa/gradio-3.16.1-py3-none-any.whl
|
run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: blocks_plug"]}, {"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 change_tab():\n", " return gr.Tabs.update(selected=2)\n", "\n", "\n", "identity_demo, input_demo, output_demo = gr.Blocks(), gr.Blocks(), gr.Blocks()\n", "\n", "with identity_demo:\n", " gr.Interface(lambda x: x, \"text\", \"text\")\n", "\n", "with input_demo:\n", " t = gr.Textbox(label=\"Enter your text here\")\n", " with gr.Row():\n", " btn = gr.Button(\"Submit\")\n", " clr = gr.Button(\"Clear\")\n", " clr.click(lambda x: \"\", t, t)\n", "\n", "with output_demo:\n", " gr.Textbox(\"This is a static output\")\n", "\n", "with gr.Blocks() as demo:\n", " gr.Markdown(\"Three demos in one!\")\n", " with gr.Tabs(selected=1) as tabs:\n", " with gr.TabItem(\"Text Identity\", id=0):\n", " identity_demo.render()\n", " with gr.TabItem(\"Text Input\", id=1):\n", " input_demo.render()\n", " with gr.TabItem(\"Text Static\", id=2):\n", " output_demo.render()\n", " btn = gr.Button(\"Change tab\")\n", " btn.click(inputs=None, outputs=tabs, fn=change_tab)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: blocks_plug"]}, {"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 change_tab():\n", " return gr.Tabs.update(selected=2)\n", "\n", "\n", "identity_demo, input_demo, output_demo = gr.Blocks(), gr.Blocks(), gr.Blocks()\n", "\n", "with identity_demo:\n", " gr.Interface(lambda x: x, \"text\", \"text\")\n", "\n", "with input_demo:\n", " t = gr.Textbox(label=\"Enter your text here\")\n", " with gr.Row():\n", " btn = gr.Button(\"Submit\")\n", " clr = gr.Button(\"Clear\")\n", " clr.click(lambda x: \"\", t, t)\n", "\n", "with output_demo:\n", " gr.Textbox(\"This is a static output\")\n", "\n", "with gr.Blocks() as demo:\n", " gr.Markdown(\"Three demos in one!\")\n", " with gr.Tabs(selected=1) as tabs:\n", " with gr.TabItem(\"Text Identity\", id=0) as tab0:\n", " tab0.select(lambda: gr.Tabs.update(selected=0), None, tabs)\n", " identity_demo.render()\n", " with gr.TabItem(\"Text Input\", id=1) as tab1:\n", " tab1.select(lambda: gr.Tabs.update(selected=1), None, tabs)\n", " input_demo.render()\n", " with gr.TabItem(\"Text Static\", id=2) as tab2:\n", " tab2.select(lambda: gr.Tabs.update(selected=2), None, tabs)\n", " output_demo.render()\n", " btn = gr.Button(\"Change tab\")\n", " btn.click(inputs=None, outputs=tabs, fn=change_tab)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
@@ -23,11 +23,14 @@ with output_demo:
|
|
23 |
with gr.Blocks() as demo:
|
24 |
gr.Markdown("Three demos in one!")
|
25 |
with gr.Tabs(selected=1) as tabs:
|
26 |
-
with gr.TabItem("Text Identity", id=0):
|
|
|
27 |
identity_demo.render()
|
28 |
-
with gr.TabItem("Text Input", id=1):
|
|
|
29 |
input_demo.render()
|
30 |
-
with gr.TabItem("Text Static", id=2):
|
|
|
31 |
output_demo.render()
|
32 |
btn = gr.Button("Change tab")
|
33 |
btn.click(inputs=None, outputs=tabs, fn=change_tab)
|
|
|
23 |
with gr.Blocks() as demo:
|
24 |
gr.Markdown("Three demos in one!")
|
25 |
with gr.Tabs(selected=1) as tabs:
|
26 |
+
with gr.TabItem("Text Identity", id=0) as tab0:
|
27 |
+
tab0.select(lambda: gr.Tabs.update(selected=0), None, tabs)
|
28 |
identity_demo.render()
|
29 |
+
with gr.TabItem("Text Input", id=1) as tab1:
|
30 |
+
tab1.select(lambda: gr.Tabs.update(selected=1), None, tabs)
|
31 |
input_demo.render()
|
32 |
+
with gr.TabItem("Text Static", id=2) as tab2:
|
33 |
+
tab2.select(lambda: gr.Tabs.update(selected=2), None, tabs)
|
34 |
output_demo.render()
|
35 |
btn = gr.Button("Change tab")
|
36 |
btn.click(inputs=None, outputs=tabs, fn=change_tab)
|