]> git.cworth.org Git - zombocom-ai/blobdiff - index.html
Generate new structure for images
[zombocom-ai] / index.html
index 83afa86e19aaa418a21fbc1825141cdfb52756c6..b7e3521aeb547020dc36d61dabde85209f14d2fc 100644 (file)
@@ -32,7 +32,7 @@
       <form action="" id="zombo-form">
         <div class="form-row large">
           <label for="prompt">
-            What do you imagine?
+            What can you imagine?
           </label>
           <textarea id="prompt" rows="4" width="100%" autocomplete="off" required></textarea>
         </div>
@@ -132,15 +132,15 @@ mute.addEventListener("click", () => {
     });
 
     socket.on('image', (image) => {
+        const figure = document.createElement('figure');
         const img = document.createElement('img');
         img.src = image.filename;
-        const p_prompt = document.createElement('p');
-        p_prompt.innerHtml = `Prompt: ${image.prompt}`;
-        const p_code = document.createElement('p');
-        p_code.innerHtml = `Code: ${image.code}`;
-        images.appendChild(img);
-        images.appendChild(p_prompt);
-        images.appendChild(p_code);
+        const figcaption = document.createElement('figcaption');
+        const caption_text = document.createTextNode(`${image.prompt} (${image.code})`);
+        figcaption.appendChild(caption_text);
+        figure.appendChild(img);
+        figure.appendChild(figcaption);
+        images.appendChild(figure);
     });
 
     zombo_form.addEventListener('submit', function(e) {