Spaces:
Running
Running
Commit ·
51b7fc2
1
Parent(s): fbcef2b
Upload folder using huggingface_hub
Browse files- requirements.txt +1 -1
- run.ipynb +1 -1
- run.py +1 -1
requirements.txt
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
https://gradio-builds.s3.amazonaws.com/
|
|
|
|
| 1 |
+
https://gradio-builds.s3.amazonaws.com/da05e59a53bbad15e5755a47f46685da18e1031e/gradio-3.44.4-py3-none-any.whl
|
run.ipynb
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: variable_outputs"]}, {"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", "max_textboxes = 10\n", "\n", "def variable_outputs(k):\n", " k = int(k)\n", " return [gr.Textbox
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: variable_outputs"]}, {"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", "max_textboxes = 10\n", "\n", "def variable_outputs(k):\n", " k = int(k)\n", " return [gr.Textbox(visible=True)]*k + [gr.Textbox(visible=False)]*(max_textboxes-k)\n", "\n", "with gr.Blocks() as demo:\n", " s = gr.Slider(1, max_textboxes, value=max_textboxes, step=1, label=\"How many textboxes to show:\")\n", " textboxes = []\n", " for i in range(max_textboxes):\n", " t = gr.Textbox(f\"Textbox {i}\")\n", " textboxes.append(t)\n", "\n", " s.change(variable_outputs, s, textboxes)\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
|
@@ -4,7 +4,7 @@ max_textboxes = 10
|
|
| 4 |
|
| 5 |
def variable_outputs(k):
|
| 6 |
k = int(k)
|
| 7 |
-
return [gr.Textbox
|
| 8 |
|
| 9 |
with gr.Blocks() as demo:
|
| 10 |
s = gr.Slider(1, max_textboxes, value=max_textboxes, step=1, label="How many textboxes to show:")
|
|
|
|
| 4 |
|
| 5 |
def variable_outputs(k):
|
| 6 |
k = int(k)
|
| 7 |
+
return [gr.Textbox(visible=True)]*k + [gr.Textbox(visible=False)]*(max_textboxes-k)
|
| 8 |
|
| 9 |
with gr.Blocks() as demo:
|
| 10 |
s = gr.Slider(1, max_textboxes, value=max_textboxes, step=1, label="How many textboxes to show:")
|