Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files
run.ipynb
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: blocks_inputs"]}, {"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": ["# Downloading files from the demo repo\n", "import os\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/blocks_inputs/lion.jpg"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import os\n", "\n", "
|
|
|
1 |
+
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: blocks_inputs"]}, {"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": ["# Downloading files from the demo repo\n", "import os\n", "!wget -q https://github.com/gradio-app/gradio/raw/main/demo/blocks_inputs/lion.jpg"]}, {"cell_type": "code", "execution_count": null, "id": "44380577570523278879349135829904343037", "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "import os\n", "\n", "def combine(a, b):\n", " return a + \" \" + b\n", "\n", "def mirror(x):\n", " return x\n", "\n", "with gr.Blocks() as demo:\n", "\n", " txt = gr.Textbox(label=\"Input\", lines=2)\n", " txt_2 = gr.Textbox(label=\"Input 2\")\n", " txt_3 = gr.Textbox(value=\"\", label=\"Output\")\n", " btn = gr.Button(value=\"Submit\")\n", " btn.click(combine, inputs=[txt, txt_2], outputs=[txt_3])\n", "\n", " with gr.Row():\n", " im = gr.Image()\n", " im_2 = gr.Image()\n", "\n", " btn = gr.Button(value=\"Mirror Image\")\n", " btn.click(mirror, inputs=[im], outputs=[im_2])\n", "\n", " gr.Markdown(\"## Text Examples\")\n", " gr.Examples(\n", " [[\"hi\", \"Adam\"], [\"hello\", \"Eve\"]],\n", " [txt, txt_2],\n", " txt_3,\n", " combine,\n", " cache_examples=True,\n", " )\n", " gr.Markdown(\"## Image Examples\")\n", " gr.Examples(\n", " examples=[os.path.join(os.path.abspath(''), \"lion.jpg\")],\n", " inputs=im,\n", " outputs=im_2,\n", " fn=mirror,\n", " cache_examples=True,\n", " )\n", "\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
|
run.py
CHANGED
@@ -1,15 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
4 |
-
|
5 |
def combine(a, b):
|
6 |
return a + " " + b
|
7 |
|
8 |
-
|
9 |
def mirror(x):
|
10 |
return x
|
11 |
|
12 |
-
|
13 |
with gr.Blocks() as demo:
|
14 |
|
15 |
txt = gr.Textbox(label="Input", lines=2)
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
|
|
|
4 |
def combine(a, b):
|
5 |
return a + " " + b
|
6 |
|
|
|
7 |
def mirror(x):
|
8 |
return x
|
9 |
|
|
|
10 |
with gr.Blocks() as demo:
|
11 |
|
12 |
txt = gr.Textbox(label="Input", lines=2)
|