File size: 1,868 Bytes
e51d906
1
{"cells": [{"cell_type": "markdown", "id": "302934307671667531413257853548643485645", "metadata": {}, "source": ["# Gradio Demo: iframe_resizer"]}, {"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", "import os\n", "from gradio import get_image\n", "\n", "\n", "def greet():\n", "    gr.Info(\"Warning in 1 second\")\n", "    time.sleep(1)\n", "    gr.Warning(\"Error in 1 second\")\n", "    time.sleep(1)\n", "    raise Exception(\"test\")\n", "\n", "\n", "im = get_image(\"cheetah.jpg\")\n", "\n", "with gr.Blocks() as demo:\n", "    with gr.Tab(\"Accordions\"):\n", "        with gr.Row(height=1500):\n", "            gr.Markdown(\"Scroll down to see UI.\")\n", "        greet_btn = gr.Button(\"Trigger toast\")\n", "        greet_btn.click(fn=greet)\n", "\n", "        with gr.Accordion(\"Accordion\"):\n", "            gr.Markdown(\n", "                \"\"\"\n", "    ## Accordion content\n", "    ### Accordion content\n", "    #### Accordion content\n", "    ##### Accordion content\n", "    ###### Accordion content\n", "    \"\"\"\n", "            )\n", "    with gr.Tab(\"Images\"):\n", "        gr.Image(value=im)\n", "        gr.Image(value=im)\n", "        gr.Image(value=im)\n", "        gr.Image(value=im)\n", "        gr.Image(value=im)\n", "        gr.Image(value=im)\n", "        gr.Image(value=im)\n", "        gr.Image(value=im)\n", "        gr.Image(value=im)\n", "        gr.Image(value=im)\n", "        gr.Image(value=im)\n", "\n", "\n", "if __name__ == \"__main__\":\n", "    demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}