{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import requests\n", "from IPython import display\n", "from base64 import b64decode\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "payload = {\n", " \"prompt\": \"cute girlhand on cheek eyes closed thinking hard, sfw\",\n", " \"styles\": [\"Bot\"],\n", " \"steps\": 70,\n", " \"seed\": -1,\n", " \"n_iter\": 1,\n", " \"height\": 1024,\n", " \"negative_prompts\": \"nsfw, not safe for work, nudity, multiple keyboards\",\n", " \"cfg_scale\": 12\n", "}\n", "\n", "settings = {\n", " \"filter_nsfw\": False,\n", " \"samples_save\": True,\n", "}\n", "\n", "override_payload = {\n", " \"override_settings\": settings\n", "}\n", "\n", "payload.update(override_payload)\n", "\n", "url = \"https://art.jurydoak.com/sdapi/v1\"\n", "# url = \"http://localhost:7860/sdapi/v1\"" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x = requests.post(f\"{url}/txt2img\", json=payload)\n", "img_html = []\n", "for i in x.json()['images']:\n", " img_html.append(f'')\n", "\n", "display.HTML(\"\\n\".join(img_html))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3.11.0 ('venv': venv)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.8 (main, Nov 1 2022, 14:18:21) [GCC 12.2.0]" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "aa19d1669203bff990bc2820f3654fa686baacd13bba0cbe075930f54e624f06" } } }, "nbformat": 4, "nbformat_minor": 2 }