File size: 1,282 Bytes
733f68f
1
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: theme_extended_step_4"]}, {"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", "import time\n", "\n", "theme = gr.themes.Default(primary_hue=\"blue\").set(\n", "    loader_color=\"#FF0000\",\n", "    slider_color=\"#FF0000\",\n", ")\n", "\n", "with gr.Blocks(\n", "    theme=theme\n", ") as demo:\n", "    textbox = gr.Textbox(label=\"Name\")\n", "    slider = gr.Slider(label=\"Count\", minimum=0, maximum=100, step=1)\n", "    with gr.Row():\n", "        button = gr.Button(\"Submit\", variant=\"primary\")\n", "        clear = gr.Button(\"Clear\")\n", "    output = gr.Textbox(label=\"Output\")\n", "\n", "    def repeat(name, count):\n", "        time.sleep(3)\n", "        return name * count\n", "\n", "    button.click(repeat, [textbox, slider], output)\n", "\n", "if __name__ == \"__main__\":\n", "    demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}