├── README.md
├── SD_T2I_360PanoImage_colab.ipynb
└── SD_T2I_360PanoImage_gradio_colab.ipynb
/README.md:
--------------------------------------------------------------------------------
1 | 🐣 Please follow me for new updates https://twitter.com/camenduru
2 | 🔥 Please join our discord server https://discord.gg/k5BwmmvJJU
3 | 🥳 Please join my patreon community https://patreon.com/camenduru
4 |
5 | ## 🦒 Colab
6 |
7 | | Colab | Info
8 | | --- | --- |
9 | [](https://colab.research.google.com/github/camenduru/SD-T2I-360PanoImage-colab/blob/main/SD_T2I_360PanoImage_colab.ipynb) | SD_T2I_360PanoImage_colab
10 | [](https://colab.research.google.com/github/camenduru/SD-T2I-360PanoImage-colab/blob/main/SD_T2I_360PanoImage_gradio_colab.ipynb) | SD_T2I_360PanoImage_gradio_colab
11 |
12 | ## Tutorial
13 | Saved image location `result.png`
14 | 
15 |
16 | For enable upscaler (Colab Pro 😐)
17 | 
18 |
19 | ## Main Repo
20 | https://github.com/ArcherFMY/SD-T2I-360PanoImage
21 |
22 | ## Page
23 | https://www.modelscope.cn/models/damo/cv_diffusion_text-to-360panorama-image_generation/summary
24 |
25 | ## Output
26 |
27 | https://github.com/camenduru/SD-T2I-360PanoImage-colab/assets/54370274/ccf0aea8-d9cd-407d-a681-c135d1f7c2df
28 |
29 | 
30 | 
31 | 
32 |
33 |
--------------------------------------------------------------------------------
/SD_T2I_360PanoImage_colab.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {
6 | "id": "view-in-github"
7 | },
8 | "source": [
9 | "[](https://colab.research.google.com/github/camenduru/SD-T2I-360PanoImage-colab/blob/main/SD_T2I_360PanoImage_colab.ipynb)"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {
16 | "id": "VjYy0F2gZIPR"
17 | },
18 | "outputs": [],
19 | "source": [
20 | "%cd /content\n",
21 | "!git clone -b dev https://github.com/camenduru/SD-T2I-360PanoImage\n",
22 | "%cd /content/SD-T2I-360PanoImage\n",
23 | "!git clone https://huggingface.co/camenduru/sd-t2i-360panoimage /content/SD-T2I-360PanoImage/models\n",
24 | "!pip install diffusers transformers accelerate realesrgan==0.3.0\n",
25 | "!pip install -q https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp310-cp310-manylinux2014_x86_64.whl\n",
26 | "!pip install /content/SD-T2I-360PanoImage"
27 | ]
28 | },
29 | {
30 | "cell_type": "code",
31 | "execution_count": null,
32 | "metadata": {},
33 | "outputs": [],
34 | "source": [
35 | "%cd /content/SD-T2I-360PanoImage\n",
36 | "import torch\n",
37 | "from txt2panoimg import Text2360PanoramaImagePipeline\n",
38 | "txt2panoimg = Text2360PanoramaImagePipeline('./models', torch_dtype=torch.float16, enable_xformers_memory_efficient_attention=True)"
39 | ]
40 | },
41 | {
42 | "cell_type": "code",
43 | "execution_count": null,
44 | "metadata": {},
45 | "outputs": [],
46 | "source": [
47 | "prompt = 'The living room'\n",
48 | "input = {'prompt': prompt, 'upscale': False}\n",
49 | "output = txt2panoimg(input)\n",
50 | "output.save('result.png')\n",
51 | "output"
52 | ]
53 | }
54 | ],
55 | "metadata": {
56 | "accelerator": "GPU",
57 | "colab": {
58 | "gpuType": "T4",
59 | "provenance": []
60 | },
61 | "kernelspec": {
62 | "display_name": "Python 3",
63 | "name": "python3"
64 | },
65 | "language_info": {
66 | "name": "python"
67 | }
68 | },
69 | "nbformat": 4,
70 | "nbformat_minor": 0
71 | }
72 |
--------------------------------------------------------------------------------
/SD_T2I_360PanoImage_gradio_colab.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {
6 | "id": "view-in-github"
7 | },
8 | "source": [
9 | "[](https://colab.research.google.com/github/camenduru/SD-T2I-360PanoImage-colab/blob/main/SD_T2I_360PanoImage_gradio_colab.ipynb)"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": null,
15 | "metadata": {
16 | "id": "VjYy0F2gZIPR"
17 | },
18 | "outputs": [],
19 | "source": [
20 | "%cd /content\n",
21 | "!git clone -b dev https://github.com/camenduru/SD-T2I-360PanoImage\n",
22 | "%cd /content/SD-T2I-360PanoImage\n",
23 | "!git clone https://huggingface.co/camenduru/sd-t2i-360panoimage /content/SD-T2I-360PanoImage/models\n",
24 | "!pip install diffusers transformers accelerate realesrgan==0.3.0\n",
25 | "!pip install -q https://download.pytorch.org/whl/cu121/xformers-0.0.22.post7-cp310-cp310-manylinux2014_x86_64.whl\n",
26 | "!pip install /content/SD-T2I-360PanoImage\n",
27 | "!pip install -q gradio gradio-pannellum\n",
28 | "\n",
29 | "%cd /content/SD-T2I-360PanoImage\n",
30 | "import torch\n",
31 | "from txt2panoimg import Text2360PanoramaImagePipeline\n",
32 | "txt2panoimg = Text2360PanoramaImagePipeline('./models', torch_dtype=torch.float16, enable_xformers_memory_efficient_attention=True)\n",
33 | "\n",
34 | "import gradio as gr\n",
35 | "from gradio_pannellum import Pannellum\n",
36 | "\n",
37 | "def generate(prompt):\n",
38 | " input = {'prompt': prompt, 'upscale': False}\n",
39 | " output = txt2panoimg(input)\n",
40 | " output.save('result.png')\n",
41 | " return output\n",
42 | "\n",
43 | "with gr.Blocks(css=\"style.css\", title=f\"Realtime Latent Consistency Model\") as demo:\n",
44 | " with gr.Column():\n",
45 | " textbox = gr.Textbox(show_label=False, value=\"The living room\")\n",
46 | " button = gr.Button(value=\"Generate\")\n",
47 | "\n",
48 | " with gr.Row(variant=\"default\"):\n",
49 | " output_image = Pannellum(show_label=False, interactive=True, show_download_button=True)\n",
50 | "\n",
51 | " button.click(fn=generate, inputs=[textbox], outputs=[output_image], show_progress=True)\n",
52 | "\n",
53 | "demo.launch(inline=False, share=True, debug=True)"
54 | ]
55 | }
56 | ],
57 | "metadata": {
58 | "accelerator": "GPU",
59 | "colab": {
60 | "gpuType": "T4",
61 | "provenance": []
62 | },
63 | "kernelspec": {
64 | "display_name": "Python 3",
65 | "name": "python3"
66 | },
67 | "language_info": {
68 | "name": "python"
69 | }
70 | },
71 | "nbformat": 4,
72 | "nbformat_minor": 0
73 | }
74 |
--------------------------------------------------------------------------------