{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"from IPython import display\n",
"from base64 import b64decode\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"payload = {\n",
" \"prompt\": \"view from behind web developer sitting in a chair, sfw\",\n",
" \"styles\": [\"default\"],\n",
" \"steps\": 28,\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://10.6.9.69:7860/sdapi/v1\""
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
"
],
"text/plain": [
""
]
},
"execution_count": 7,
"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.11.0"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "aa19d1669203bff990bc2820f3654fa686baacd13bba0cbe075930f54e624f06"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}