{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "aa94f368-32f2-4f93-8ff0-5f66fd993263", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/opt/conda/lib/python3.10/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n", " torch.utils._pytree._register_pytree_node(\n", "/opt/conda/lib/python3.10/site-packages/diffusers/utils/outputs.py:63: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n", " torch.utils._pytree._register_pytree_node(\n" ] } ], "source": [ "import torch\n", "from diffusers import (\n", "\n", " StableDiffusionXLPipeline, \n", " StableDiffusionXLImg2ImgPipeline,\n", " UNet2DConditionModel, \n", " EulerDiscreteScheduler\n", ")\n", "from huggingface_hub import hf_hub_download\n", "from safetensors.torch import load_file\n", "from diffusers.utils import load_image" ] }, { "cell_type": "code", "execution_count": 3, "id": "a2ecc286-2280-498f-872e-39c86a4a1242", "metadata": { "scrolled": true }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "5a0182e4b1b347539d77fc45e918229f", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Fetching 19 files: 0%| | 0/19 [00:00" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pipe(\n", " prompt=\"Rafflesia flower in full bloom surrounded by huge thick, fleshy oval lobes with pointed tips, entire flower is a deep red brown, speckled with white spots, giving it a speckled appearance, set in a lush green rainforest, Vibrant colors, Macro lens, f/4 aperture, ISO 200, natural diffused light\",\n", " negative_prompt=\"out of frame, low-res, text, error, cropped, worst quality, low quality, jpeg artifacts, duplicate, morbid, mutilated, out of frame, poorly drawn, mutation, deformed, blurry, bad anatomy, bad proportions, missing parts, extra limbs, fused parts, too many spots, long stem, username, watermark, signature\",\n", " num_inference_steps=50,\n", " guidance_scale=12\n", ").images[0]" ] }, { "cell_type": "code", "execution_count": 27, "id": "370e32c1-fcf3-45b7-b1c4-e2075a26df78", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "555a47560e0b4e709809846591ee2f68", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/50 [00:00" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pipe(\n", " prompt=\"Encephalartos Woodii flower, a rare cycad species, bright yellow-orange Cone structure with tightly packed scales, lush green and brown surroundings, Macro lens, f/5.6 aperture, ISO 400, natural diffused sunlight filtering through the forest canopy\",\n", " negative_prompt=\"out of frame, low-res, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, poorly drawn, mutation, deformed, blurry, bad anatomy, bad proportions, missing parts, extra limbs, fused parts, too many scales, long stem, username, watermark, signature\",\n", " num_inference_steps=50,\n", " guidance_scale=12\n", ").images[0]" ] }, { "cell_type": "code", "execution_count": 33, "id": "7ce4fcb5-7fca-4513-b285-bffc8a77a851", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "24e7eda3383148a8ad6eb1812eb73911", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/50 [00:00" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pipe(\n", " prompt=\"Top View of Amorphophallus Titanum Corpse Flower, towering inflorescence with a deep burgundy spathe and a tall, yellow-green phallic spadix, Set against a lush jungle background, Atmospheric mood with a hint of mist, Wide-angle lens, f/11 aperture, ISO 100, soft diffused natural light\",\n", " negative_prompt=\"out of frame, low-res, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, poorly drawn, mutation, deformed, blurry, bad anatomy, bad proportions, missing parts, extra limbs, fused parts, too many scales, long stem, username, watermark, signature\",\n", " num_inference_steps=50,\n", " guidance_scale=12\n", ").images[0]" ] }, { "cell_type": "code", "execution_count": 35, "id": "05b9a8fc-5a5a-4125-8bc2-9cbe6b554d13", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "7e567bf9bd854a939e8c3c1a5faeb67b", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/50 [00:00" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pipe(\n", " prompt=\"Ghost Orchid flower, delicate and ethereal, Translucent white petals with a hint of green, Suspended in mid-air against a dark, misty forest background, Mysterious and haunting atmosphere, Macro lens, f/2.8 aperture, ISO 800, soft, diffused lighting\",\n", " negative_prompt=\"out of frame, low-res, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, poorly drawn, mutation, deformed, blurry, bad anatomy, bad proportions, missing parts, extra limbs, fused parts, too many scales, long stem, username, watermark, signature\",\n", " num_inference_steps=50,\n", " guidance_scale=12\n", ").images[0]" ] }, { "cell_type": "code", "execution_count": 36, "id": "5ef06f17-0cd6-4d36-85bd-c6d01c1b2b55", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "d7b464ba4f684f4296c8d11def6de819", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/50 [00:00" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pipe(\n", " prompt=\"Dragon Blood Tree, Dracaena cinnabari, standing majestically on a rocky cliff, Distinctive umbrella-shaped thick and dense canopy with dense, sword-like leaves, Rich green foliage contrasting against a clear blue sky, Rugged, arid landscape in the background, Wide-angle lens, f/8 aperture, ISO 100, bright, natural sunlight\",\n", " negative_prompt=\"out of frame, low-res, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, poorly drawn, mutation, deformed, blurry, bad anatomy, bad proportions, missing parts, extra limbs, fused parts, too many scales, long stem, username, watermark, signature\",\n", " num_inference_steps=50,\n", " guidance_scale=12\n", ").images[0]" ] }, { "cell_type": "code", "execution_count": 37, "id": "d41b92c9-f8b4-4f02-820b-774039c4411d", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "a8dbd819d95741e4be9a813c4a5a48a4", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/50 [00:00" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "image = pipe(\n", " prompt=\"Ghost Orchid flower, delicate and ethereal, Translucent white petals with a hint of green, Suspended in mid-air against a dark, misty forest background, Mysterious and haunting atmosphere, Macro lens, f/2.8 aperture, ISO 800, soft, diffused lighting\",\n", " negative_prompt=\"out of frame, low-res, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, poorly drawn, mutation, deformed, blurry, bad anatomy, bad proportions, missing parts, extra limbs, fused parts, too many scales, long stem, username, watermark, signature\",\n", " num_inference_steps=50,\n", " guidance_scale=12\n", ").images[0]\n", "\n", "image" ] }, { "cell_type": "code", "execution_count": 38, "id": "7f0e9335-e2b6-4a6b-b6bd-73992ef10131", "metadata": {}, "outputs": [], "source": [ "image.save('image.png')" ] }, { "cell_type": "code", "execution_count": 9, "id": "673bb1f4-1301-43f4-a9bf-74f900bc20b7", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "0e4b6cf390724123ac4c40c40a177d64", "version_major": 2, "version_minor": 0 }, "text/plain": [ " 0%| | 0/15 [00:00" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "image[0]" ] }, { "cell_type": "code", "execution_count": null, "id": "c6476513-1bb4-44d5-824f-ffadbc2a5df7", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "research", "language": "python", "name": "research" }, "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.13" } }, "nbformat": 4, "nbformat_minor": 5 }