File size: 941 Bytes
b06092a
1
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: dropdown_custom_value"]}, {"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\n", "\n", "with gradio.Blocks() as demo:\n", "    dropdown = gradio.Dropdown(\n", "        choices=[(\"hello\", \"goodbye\"), (\"abc\", \"123\")],\n", "        allow_custom_value=True,\n", "        label=\"Dropdown\",\n", "    )\n", "    text = gradio.Textbox(label=\"Output\")\n", "    dropdown.change(lambda x: x, inputs=dropdown, outputs=text)\n", "\n", "if __name__ == \"__main__\":\n", "    demo.launch()"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}