{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "provenance": [], "authorship_tag": "ABX9TyPKBKhp0febZwFeoBEUFB5r" }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "4bd64e113ca7427998bd22fa07c6a5b2": { "model_module": "@jupyter-widgets/controls", "model_name": "ButtonModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ButtonModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ButtonView", "button_style": "success", "description": "✔ Done", "disabled": true, "icon": "", "layout": "IPY_MODEL_b67f1fa6fa7142d6b90c3a04600083d2", "style": "IPY_MODEL_74cc9bb3b6124b8ab184ed5e16bd8cbb", "tooltip": "" } }, "b67f1fa6fa7142d6b90c3a04600083d2": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": "50px", "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "74cc9bb3b6124b8ab184ed5e16bd8cbb": { "model_module": "@jupyter-widgets/controls", "model_name": "ButtonStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ButtonStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "button_color": null, "font_weight": "" } } } } }, "cells": [ { "cell_type": "code", "source": [ "#@markdown # Connect Google Drive\n", "from google.colab import drive\n", "from IPython.display import clear_output\n", "import ipywidgets as widgets\n", "import os\n", "\n", "def inf(msg, style, wdth): inf = widgets.Button(description=msg, disabled=True, button_style=style, layout=widgets.Layout(min_width=wdth));display(inf)\n", "Shared_Drive = \"\" #@param {type:\"string\"}\n", "#@markdown - Leave empty if you're not using a shared drive\n", "\n", "print(\"\u001b[0;33mConnecting...\")\n", "drive.mount('/content/gdrive')\n", "\n", "if Shared_Drive!=\"\" and os.path.exists(\"/content/gdrive/Shareddrives\"):\n", " mainpth=\"Shareddrives/\"+Shared_Drive\n", "else:\n", " mainpth=\"MyDrive\"\n", "\n", "clear_output()\n", "inf('\\u2714 Done','success', '50px')\n", "\n", "#@markdown ---" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 49, "referenced_widgets": [ "4bd64e113ca7427998bd22fa07c6a5b2", "b67f1fa6fa7142d6b90c3a04600083d2", "74cc9bb3b6124b8ab184ed5e16bd8cbb" ] }, "id": "PsMA61hEqyny", "outputId": "48da1305-ded8-439b-c904-d6fac6669d7b" }, "execution_count": 1, "outputs": [ { "output_type": "display_data", "data": { "text/plain": [ "Button(button_style='success', description='✔ Done', disabled=True, layout=Layout(min_width='50px'), style=But…" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "4bd64e113ca7427998bd22fa07c6a5b2" } }, "metadata": {} } ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "YXvRbuFFoPQT", "outputId": "d9fc704d-9192-4845-cbd7-91c4fd07b0eb" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Collecting gradio\n", " Downloading gradio-3.50.2-py3-none-any.whl (20.3 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m20.3/20.3 MB\u001b[0m \u001b[31m54.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting aiofiles<24.0,>=22.0 (from gradio)\n", " Downloading aiofiles-23.2.1-py3-none-any.whl (15 kB)\n", "Requirement already satisfied: altair<6.0,>=4.2.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (4.2.2)\n", "Collecting fastapi (from gradio)\n", " Downloading fastapi-0.104.0-py3-none-any.whl (92 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m92.9/92.9 kB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting ffmpy (from gradio)\n", " Downloading ffmpy-0.3.1.tar.gz (5.5 kB)\n", " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", "Collecting gradio-client==0.6.1 (from gradio)\n", " Downloading gradio_client-0.6.1-py3-none-any.whl (299 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m299.2/299.2 kB\u001b[0m \u001b[31m28.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting httpx (from gradio)\n", " Downloading httpx-0.25.0-py3-none-any.whl (75 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.7/75.7 kB\u001b[0m \u001b[31m9.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting huggingface-hub>=0.14.0 (from gradio)\n", " Downloading huggingface_hub-0.18.0-py3-none-any.whl (301 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m302.0/302.0 kB\u001b[0m \u001b[31m26.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: importlib-resources<7.0,>=1.3 in /usr/local/lib/python3.10/dist-packages (from gradio) (6.1.0)\n", "Requirement already satisfied: jinja2<4.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (3.1.2)\n", "Requirement already satisfied: markupsafe~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (2.1.3)\n", "Requirement already satisfied: matplotlib~=3.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (3.7.1)\n", "Requirement already satisfied: numpy~=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (1.23.5)\n", "Collecting orjson~=3.0 (from gradio)\n", " Downloading orjson-3.9.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (138 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m138.7/138.7 kB\u001b[0m \u001b[31m12.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from gradio) (23.2)\n", "Requirement already satisfied: pandas<3.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (1.5.3)\n", "Requirement already satisfied: pillow<11.0,>=8.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (9.4.0)\n", "Requirement already satisfied: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4 in /usr/local/lib/python3.10/dist-packages (from gradio) (1.10.13)\n", "Collecting pydub (from gradio)\n", " Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)\n", "Collecting python-multipart (from gradio)\n", " Downloading python_multipart-0.0.6-py3-none-any.whl (45 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.7/45.7 kB\u001b[0m \u001b[31m4.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: pyyaml<7.0,>=5.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (6.0.1)\n", "Requirement already satisfied: requests~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (2.31.0)\n", "Collecting semantic-version~=2.0 (from gradio)\n", " Downloading semantic_version-2.10.0-py2.py3-none-any.whl (15 kB)\n", "Requirement already satisfied: typing-extensions~=4.0 in /usr/local/lib/python3.10/dist-packages (from gradio) (4.5.0)\n", "Collecting uvicorn>=0.14.0 (from gradio)\n", " Downloading uvicorn-0.23.2-py3-none-any.whl (59 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m59.5/59.5 kB\u001b[0m \u001b[31m6.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting websockets<12.0,>=10.0 (from gradio)\n", " Downloading websockets-11.0.3-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (129 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m129.9/129.9 kB\u001b[0m \u001b[31m13.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from gradio-client==0.6.1->gradio) (2023.6.0)\n", "Requirement already satisfied: entrypoints in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio) (0.4)\n", "Requirement already satisfied: jsonschema>=3.0 in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio) (4.19.1)\n", "Requirement already satisfied: toolz in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio) (0.12.0)\n", "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio) (3.12.4)\n", "Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio) (4.66.1)\n", "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (1.1.1)\n", "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (0.12.1)\n", "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (4.43.1)\n", "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (1.4.5)\n", "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (3.1.1)\n", "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio) (2.8.2)\n", "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3.0,>=1.0->gradio) (2023.3.post1)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio) (3.3.0)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio) (3.4)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio) (2.0.7)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio) (2023.7.22)\n", "Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn>=0.14.0->gradio) (8.1.7)\n", "Collecting h11>=0.8 (from uvicorn>=0.14.0->gradio)\n", " Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m6.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: anyio<4.0.0,>=3.7.1 in /usr/local/lib/python3.10/dist-packages (from fastapi->gradio) (3.7.1)\n", "Collecting starlette<0.28.0,>=0.27.0 (from fastapi->gradio)\n", " Downloading starlette-0.27.0-py3-none-any.whl (66 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.0/67.0 kB\u001b[0m \u001b[31m7.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hCollecting typing-extensions~=4.0 (from gradio)\n", " Downloading typing_extensions-4.8.0-py3-none-any.whl (31 kB)\n", "Collecting httpcore<0.19.0,>=0.18.0 (from httpx->gradio)\n", " Downloading httpcore-0.18.0-py3-none-any.whl (76 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m76.0/76.0 kB\u001b[0m \u001b[31m9.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio) (1.3.0)\n", "Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from anyio<4.0.0,>=3.7.1->fastapi->gradio) (1.1.3)\n", "Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (23.1.0)\n", "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (2023.7.1)\n", "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (0.30.2)\n", "Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio) (0.10.6)\n", "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib~=3.0->gradio) (1.16.0)\n", "Building wheels for collected packages: ffmpy\n", " Building wheel for ffmpy (setup.py) ... \u001b[?25l\u001b[?25hdone\n", " Created wheel for ffmpy: filename=ffmpy-0.3.1-py3-none-any.whl size=5579 sha256=20e3a3d081fba3e6b2fd3d72da1820db62227a8909bbe93f2cb55db32817eb91\n", " Stored in directory: /root/.cache/pip/wheels/01/a6/d1/1c0828c304a4283b2c1639a09ad86f83d7c487ef34c6b4a1bf\n", "Successfully built ffmpy\n", "Installing collected packages: pydub, ffmpy, websockets, typing-extensions, semantic-version, python-multipart, orjson, h11, aiofiles, uvicorn, starlette, huggingface-hub, httpcore, httpx, fastapi, gradio-client, gradio\n", " Attempting uninstall: typing-extensions\n", " Found existing installation: typing_extensions 4.5.0\n", " Uninstalling typing_extensions-4.5.0:\n", " Successfully uninstalled typing_extensions-4.5.0\n", "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", "lida 0.0.10 requires kaleido, which is not installed.\n", "tensorflow-probability 0.22.0 requires typing-extensions<4.6.0, but you have typing-extensions 4.8.0 which is incompatible.\u001b[0m\u001b[31m\n", "\u001b[0mSuccessfully installed aiofiles-23.2.1 fastapi-0.104.0 ffmpy-0.3.1 gradio-3.50.2 gradio-client-0.6.1 h11-0.14.0 httpcore-0.18.0 httpx-0.25.0 huggingface-hub-0.18.0 orjson-3.9.9 pydub-0.25.1 python-multipart-0.0.6 semantic-version-2.10.0 starlette-0.27.0 typing-extensions-4.8.0 uvicorn-0.23.2 websockets-11.0.3\n", "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (2.31.0)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests) (3.3.0)\n", "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests) (3.4)\n", "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests) (2.0.7)\n", "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests) (2023.7.22)\n", "Requirement already satisfied: pillow in /usr/local/lib/python3.10/dist-packages (9.4.0)\n" ] } ], "source": [ "#@markdown # Install Requirements\n", "\n", "!pip install gradio\n", "!pip install requests\n", "!pip install pillow" ] }, { "cell_type": "code", "source": [ "#@markdown # Run Interface\n", "\n", "import gradio as gr\n", "import requests\n", "import io\n", "import random\n", "import os\n", "from PIL import Image\n", "\n", "HF_READ_TOKEN = \"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\" #@param {type:\"string\"}\n", "API_URL = \"https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0\"\n", "headers = {\"Authorization\": f\"Bearer {HF_READ_TOKEN}\"}\n", "\n", "def query(prompt, is_negative=False, image_style=\"None style\", steps=50, cfg_scale=7, seed=None):\n", " if image_style == \"None style\":\n", " payload = {\n", " \"inputs\": prompt + \", 8k\",\n", " \"is_negative\": is_negative,\n", " \"steps\": steps,\n", " \"cfg_scale\": cfg_scale,\n", " \"seed\": seed if seed is not None else random.randint(-1, 2147483647)\n", " }\n", " elif image_style == \"Cinematic\":\n", " payload = {\n", " \"inputs\": prompt+\", realistic, detailed, textured, skin, hair, eyes, by Alex Huguet, Mike Hill, Ian Spriggs, JaeCheol Park, Marek Denko\",\n", " \"is_negative\": is_negative+\", abstract, cartoon, stylized\",\n", " \"steps\": steps,\n", " \"cfg_scale\": cfg_scale,\n", " \"seed\": seed if seed is not None else random.randint(-1, 2147483647)\n", " }\n", " elif image_style == \"Digital Art\":\n", " payload = {\n", " \"inputs\": prompt + \", faded , vintage , nostalgic , by Jose Villa , Elizabeth Messina , Ryan Brenizer , Jonas Peterson , Jasmine Star\",\n", " \"is_negative\": is_negative + \", sharp , modern , bright\",\n", " \"steps\": steps,\n", " \"cfg_scale\": cfg_scale,\n", " \"seed\": seed if seed is not None else random.randint(-1, 2147483647)\n", " }\n", " elif image_style == \"Portrait\":\n", " payload = {\n", " \"inputs\": prompt + \", soft light, sharp, exposure blend, medium shot, bokeh, (hdr:1.4), high contrast, (cinematic, teal and orange:0.85), (muted colors, dim colors, soothing tones:1.3), low saturation, (hyperdetailed:1.2), (noir:0.4), (natural skin texture, hyperrealism, soft light, sharp:1.2)\",\n", " \"is_negative\": is_negative,\n", " \"steps\": steps,\n", " \"cfg_scale\": cfg_scale,\n", " \"seed\": seed if seed is not None else random.randint(-1, 2147483647)\n", " }\n", " # Вставьте ваш код для запроса к модели и получения изображения\n", " image_bytes = requests.post(API_URL, headers=headers, json=payload).content\n", " image = Image.open(io.BytesIO(image_bytes))\n", " return image\n", "\n", "\n", "css = \"\"\"\n", " .gradio-container {\n", " font-family: 'IBM Plex Sans', sans-serif;\n", " }\n", " .gr-button {\n", " color: white;\n", " border-color: black;\n", " background: black;\n", " }\n", " input[type='range'] {\n", " accent-color: black;\n", " }\n", " .dark input[type='range'] {\n", " accent-color: #dfdfdf;\n", " }\n", " .gradio-container {\n", " max-width: 730px !important;\n", " margin: auto;\n", " padding-top: 1.5rem;\n", " }\n", " #gallery {\n", " min-height: 22rem;\n", " margin-bottom: 15px;\n", " margin-left: auto;\n", " margin-right: auto;\n", " border-bottom-right-radius: .5rem !important;\n", " border-bottom-left-radius: .5rem !important;\n", " }\n", " #gallery>div>.h-full {\n", " min-height: 20rem;\n", " }\n", " .details:hover {\n", " text-decoration: underline;\n", " }\n", " .gr-button {\n", " white-space: nowrap;\n", " }\n", " .gr-button:focus {\n", " border-color: rgb(147 197 253 / var(--tw-border-opacity));\n", " outline: none;\n", " box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n", " --tw-border-opacity: 1;\n", " --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n", " --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px var(--tw-ring-offset-width)) var(--tw-ring-color);\n", " --tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity));\n", " --tw-ring-opacity: .5;\n", " }\n", " #advanced-btn {\n", " font-size: .7rem !important;\n", " line-height: 19px;\n", " margin-top: 12px;\n", " margin-bottom: 12px;\n", " padding: 2px 8px;\n", " border-radius: 14px !important;\n", " }\n", " #advanced-options {\n", " display: none;\n", " margin-bottom: 20px;\n", " }\n", " .footer {\n", " margin-bottom: 45px;\n", " margin-top: 35px;\n", " text-align: center;\n", " border-bottom: 1px solid #e5e5e5;\n", " }\n", " .footer>p {\n", " font-size: .8rem;\n", " display: inline-block;\n", " padding: 0 10px;\n", " transform: translateY(10px);\n", " background: white;\n", " }\n", " .dark .footer {\n", " border-color: #303030;\n", " }\n", " .dark .footer>p {\n", " background: #0b0f19;\n", " }\n", " .acknowledgments h4{\n", " margin: 1.25em 0 .25em 0;\n", " font-weight: bold;\n", " font-size: 115%;\n", " }\n", " .animate-spin {\n", " animation: spin 1s linear infinite;\n", " }\n", " @keyframes spin {\n", " from {\n", " transform: rotate(0deg);\n", " }\n", " to {\n", " transform: rotate(360deg);\n", " }\n", " }\n", " #share-btn-container {padding-left: 0.5rem !important; padding-right: 0.5rem !important; background-color: #000000; justify-content: center; align-items: center; border-radius: 9999px !important; max-width: 13rem; margin-left: auto;}\n", " div#share-btn-container > div {flex-direction: row;background: black;align-items: center}\n", " #share-btn-container:hover {background-color: #060606}\n", " #share-btn {all: initial; color: #ffffff;font-weight: 600; cursor:pointer; font-family: 'IBM Plex Sans', sans-serif; margin-left: 0.5rem !important; padding-top: 0.5rem !important; padding-bottom: 0.5rem !important;right:0;}\n", " #share-btn * {all: unset}\n", " #share-btn-container div:nth-child(-n+2){width: auto !important;min-height: 0px !important;}\n", " #share-btn-container .wrap {display: none !important}\n", " #share-btn-container.hidden {display: none!important}\n", "\n", " .gr-form{\n", " flex: 1 1 50%; border-top-right-radius: 0; border-bottom-right-radius: 0;\n", " }\n", " #prompt-container{\n", " gap: 0;\n", " }\n", " #prompt-container .form{\n", " border-top-right-radius: 0;\n", " border-bottom-right-radius: 0;\n", " }\n", " #gen-button{\n", " border-top-left-radius:0;\n", " border-bottom-left-radius:0;\n", " }\n", " #prompt-text-input, #negative-prompt-text-input{padding: .45rem 0.625rem}\n", " #component-16{border-top-width: 1px!important;margin-top: 1em}\n", " .image_duplication{position: absolute; width: 100px; left: 50px}\n", " .tabitem{border: 0 !important}\n", "\"\"\"\n", "\n", "with gr.Blocks(css=css) as sdxl:\n", " gr.HTML(\n", " \"\"\"\n", "
\n", " SDXL is a high quality text-to-image model from Stability AI. This demo is running on HuggingFace Inference API ⚡, to achieve efficient and cost-effective inference of 1024×1024 images. What model?\n", "
\n", "