<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yviel Castillejos on Medium]]></title>
        <description><![CDATA[Stories by Yviel Castillejos on Medium]]></description>
        <link>https://medium.com/@yvielcastillejos8?source=rss-103bee5a4687------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vltA1EZAFaRtfbUnBX-Jng.jpeg</url>
            <title>Stories by Yviel Castillejos on Medium</title>
            <link>https://medium.com/@yvielcastillejos8?source=rss-103bee5a4687------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:26:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yvielcastillejos8/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Comic Generator using Large Language Models (A Tutorial).]]></title>
            <link>https://medium.com/@yvielcastillejos8/comic-generator-using-large-language-models-a-tutorial-13c4e33fad3?source=rss-103bee5a4687------2</link>
            <guid isPermaLink="false">https://medium.com/p/13c4e33fad3</guid>
            <category><![CDATA[stable-diffusion]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[random-comic-generator]]></category>
            <category><![CDATA[gpt]]></category>
            <dc:creator><![CDATA[Yviel Castillejos]]></dc:creator>
            <pubDate>Sat, 15 Apr 2023 22:13:05 GMT</pubDate>
            <atom:updated>2023-04-15T22:13:05.955Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>To see the process of comic generation, kindly visit <a href="https://github.com/yvielcastillejos/Comic-Generator">https://github.com/yvielcastillejos/Comic-Generator</a>. Additionally, the repository features a Google Colab version that provides a Web UI for a more convenient experience.</blockquote><h3>1.0 Main Pipeline</h3><p>The Comic Generator is made up of two main elements: the Story Generator and the Visual Generator. The Story Generator is further divided into three sections responsible for generating story ideas, crafting characters, and shaping plots. These sections use GPT-3 to produce their respective outcomes and follow a linear process, as shown in Figure 1.0. In contrast, the Visual Generator leverages Stable Diffusion to create comic strips. To connect the Visual Generator to the Story Generator, GPT-3 is used to generate input prompts. In the end, a fully formed comic is produced as the final result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lH4-wtbu0GULMdPVCqVvBQ.png" /><figcaption>Figure 1.0: Main Architecture of Proposed Comic Generator</figcaption></figure><h3>2.0 Story Generation</h3><p>To create the comic’s story, we utilize the GPT-3 model, known for generating coherent and contextually appropriate text. We provide the model with a short prompt that sets the context or theme of the comic. In response, GPT-3 produces a series of connected sentences or expressions that form the comic’s script.</p><h4>2.1 Story Idea Generation Prompting</h4><p>We use GPT-3 to generate story plot ideas for comics. To do this, we prompt the model with</p><p>“Give a list of five story plot ideas.”</p><p>This gives users a range of options to choose from, allowing for flexibility and creativity in selecting a plot that fits their vision and audience. With GPT-3, users can save time and energy brainstorming ideas and focus on developing their narrative and visuals. This method kickstarts the creative process and empowers users to create engaging stories that showcase our model’s potential.</p><h4>2.2 Character Generation Prompting</h4><p>To create a character list for the comic, we use GPT-3 and a specific prompt that establishes the format and context. The prompt reads,</p><p>“Give a list of five main characters with the format character name: character description. The character is the main character of the story, and the story is about the story.”</p><p>This guides the model to produce relevant characters with detailed descriptions for the intended story and desired style. The user can then select characters that match their vision, offering flexibility and creative freedom.</p><h4>2.3 Dialogue Generation Prompting</h4><p>To produce engaging character dialogues, we use a specific prompt format:</p><p>“Generate a story of ‘prompt’ with Dialogue. The story SHOULD only contain one character talking to themselves, and the Dialogue SHOULD only contain three lines of dialogue. CHARACTERS: Character1 name: Character1 description SCENE:”.</p><p>This format guides GPT-3 to create coherent dialogues tailored to the character and story context. The structured prompt ensures concise yet impactful dialogues, focusing on the character’s emotions and thoughts. This method effectively generates captivating dialogues, demonstrating GPT-3’s prowess in story generation.</p><h3>3.0 Visual Generation</h3><p>We use a Stable Diffusion model for the visual aspect of the comic. The model has been fine-tuned using user-drawn character images and can generate images of the characters in different narrative settings by employing Textual Inversion and Dream Booth techniques. Once the GPT-3 model generates the story, the Stable Diffusion model synthesizes a sequence of images that corresponds to the story.</p><p>To maintain consistency between the visual and language parts of the comic, we implement a post-processing step that aligns the generated text and images. This step adjusts both elements as needed to ensure that the comic panels are coherent and well-connected.</p><h3>4.0 Training Stable Diffusion, A Tutorial</h3><h4>4.1 Input Images Preparation</h4><p>Prepare a set of 512x512 images of a character of choice, an example is shown in Figure 4.0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*H5iEBx2rt1vpjEvma_6hVw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/0*bMM3uWO2i-2-zhFx" /><figcaption>Figure 4.0: Input Images sample</figcaption></figure><p>One can also employ data augmentation techniques such as data flipping and masking in order to increase the dataset amount as shown in Figure 4.3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fLkdtSIutWYFOIdfXk0JcA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uz-7H4xl1HpTSyywtOOHGA.png" /><figcaption>Figure 4.3: Data Augmentation</figcaption></figure><h4>4.2 Stable Diffusion fine-tuning on Colab using Dreambooth</h4><blockquote>Please use this colab link for dreambooth training on colab: <a href="https://colab.research.google.com/drive/1cN59N1RGyHwCYkPmbretBz1jTEH7FYQF#scrollTo=AsWk2MBz1RdO">https://colab.research.google.com/drive/1cN59N1RGyHwCYkPmbretBz1jTEH7FYQF#scrollTo=AsWk2MBz1RdO</a></blockquote><p>Before getting started with the training, there are a few requirements that must be met:</p><ol><li>Create a HUGGINGFACE Token in order to download the baseline model of Stable Diffusion by logging into <a href="https://huggingface.co/">https://huggingface.co</a> . The tokens can be viewed here: <a href="https://huggingface.co/settings/tokens">https://huggingface.co/settings/tokens</a></li><li>You need to accept the model license. Please, visit https://huggingface.co/runwayml/stable-diffusion-v1-5, read the license and tick the checkbox if you agree.</li><li>Change the contents of concepts list in the Colab notebook. Place your input images in your instance_data_dir folder. Your instance_prompt is the token you will be using to describe your character and your class_prompt is the best class description of your character.</li></ol><pre># You can also add multiple concepts here. Try tweaking `--max_train_steps` accordingly.<br><br>concepts_list = [<br>    {<br>        &quot;instance_prompt&quot;:      &quot;partyxyz girl&quot;,<br>        &quot;class_prompt&quot;:         &quot;girl&quot;,<br>        &quot;instance_data_dir&quot;:    &quot;/content/data/partyxyzgirl&quot;,<br>        &quot;class_data_dir&quot;:       &quot;/content/data/girl&quot;<br>    },<br><br>]<br><br># `class_data_dir` contains regularization images<br>import json<br>import os<br>for c in concepts_list:<br>    os.makedirs(c[&quot;instance_data_dir&quot;], exist_ok=True)<br><br>with open(&quot;concepts_list.json&quot;, &quot;w&quot;) as f:<br>    json.dump(concepts_list, f, indent=4)</pre><p>4. Follow the rest of the training instructions in the Google Colab Notebook by running the cells.</p><h3>5.0 Comic Generator</h3><blockquote>To host a web U.I. for your model, visit <a href="https://colab.research.google.com/drive/1WkVlG8LyapurDNgKWpBZ28Du5r2xeroz?usp=sharing">https://colab.research.google.com/drive/1WkVlG8LyapurDNgKWpBZ28Du5r2xeroz?usp=sharing</a>.</blockquote><p>To start creating comics, we must then host a website that deploys our stable diffusion model. Kindly change the variable MODEL_PATH in the Host Server cell in the notebook to the path of your model. Furthermore, change the API_KEY using your own GPT-3 token. Once we start running the server.py script, we should see the following output:</p><pre>2023-04-15 21:36:09.866793: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT<br> * Serving Flask app &#39;server&#39;<br> * Debug mode: off<br>WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.<br> * Running on http://127.0.0.1:5000<br>Press CTRL+C to quit<br> * Running on http://5158-34-124-218-181.ngrok-free.app<br> * Traffic stats available on http://127.0.0.1:4040</pre><p>Click on the second link where it mentions: “Running on &lt;ngrok server&gt;”, and kindly follow the instructions to start generating the comic. The pipeline to the web UI is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cuf1OvLgDOYf4bBIboHsrA.png" /><figcaption>Figure 5.0: Pipeline of Architecture</figcaption></figure><h3>6.0 Samples</h3><p>Some samples are shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XCkKVh_FX-xGxDjFevt4hg.png" /><figcaption>Figure 6.0: Note the chat bubbles are manually added</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*spHikQZd6YY77W-Af2QS8w.png" /><figcaption>Figure 6.1: Sample input from the WEB UI</figcaption></figure><h3>7.0 Limitations</h3><p>There are still a few limitations to the model:</p><ol><li>The models are designed to support only one character. Two or more characters add complexity and noise in the generated output.</li><li>Using a well-known person or character’s name might result in undesired outputs.</li><li>So far, it is difficult for the user to control the outputs of the Stable Diffusion model.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13c4e33fad3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>