Spaces:
Running
Running
Expose strength option, misc form edits
Browse files- src/routes/+page.svelte +17 -3
src/routes/+page.svelte
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
import { onMount, tick } from 'svelte';
|
3 |
|
4 |
let txt = '';
|
|
|
5 |
let isLoading = false;
|
6 |
let isOutputControlAdded = false;
|
7 |
let drawingBoard: any;
|
@@ -97,7 +98,7 @@
|
|
97 |
const { imgFile, imgBitmap: initialSketchBitmap } = await getCanvasSnapshot(canvas);
|
98 |
const form = new FormData();
|
99 |
form.append('prompt', txt);
|
100 |
-
form.append('strength',
|
101 |
form.append('image', imgFile);
|
102 |
|
103 |
try {
|
@@ -382,6 +383,19 @@
|
|
382 |
<div id="board-container" bind:this={canvasContainerEl} />
|
383 |
{#if canvas}
|
384 |
<div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
<div class="flex gap-x-2 mt-3 items-start justify-center {isLoading ? 'animate-pulse' : ''}">
|
386 |
<span
|
387 |
class="overflow-auto resize-y py-2 px-3 min-h-[42px] max-h-[500px] !w-[181px] whitespace-pre-wrap inline-block border border-gray-200 shadow-inner outline-none"
|
@@ -390,13 +404,13 @@
|
|
390 |
style="--placeholder: 'Add prompt'"
|
391 |
spellcheck="false"
|
392 |
dir="auto"
|
393 |
-
maxlength="
|
394 |
bind:textContent={txt}
|
395 |
on:keydown={onKeyDown}
|
396 |
/>
|
397 |
<button
|
398 |
on:click={submitRequest}
|
399 |
-
class="bg-green-700 hover:bg-green-800 text-white font-bold py-[0.555rem] px-4"
|
400 |
>
|
401 |
diffuse 🪄
|
402 |
</button>
|
|
|
2 |
import { onMount, tick } from 'svelte';
|
3 |
|
4 |
let txt = '';
|
5 |
+
let strength = '0.85';
|
6 |
let isLoading = false;
|
7 |
let isOutputControlAdded = false;
|
8 |
let drawingBoard: any;
|
|
|
98 |
const { imgFile, imgBitmap: initialSketchBitmap } = await getCanvasSnapshot(canvas);
|
99 |
const form = new FormData();
|
100 |
form.append('prompt', txt);
|
101 |
+
form.append('strength', strength);
|
102 |
form.append('image', imgFile);
|
103 |
|
104 |
try {
|
|
|
383 |
<div id="board-container" bind:this={canvasContainerEl} />
|
384 |
{#if canvas}
|
385 |
<div>
|
386 |
+
<div class="flex gap-x-2 mt-3 items-start justify-center align-vertical {isLoading ? 'animate-pulse' : ''}">
|
387 |
+
<p class="font-bold align-middle py-2">Strength:</p>
|
388 |
+
<span
|
389 |
+
class="overflow-auto resize-y py-2 px-3 min-h-[42px] max-h-[500px] !w-[181px] whitespace-pre-wrap inline-block border border-gray-200 shadow-inner outline-none"
|
390 |
+
role="textbox"
|
391 |
+
contenteditable
|
392 |
+
spellcheck="false"
|
393 |
+
dir="auto"
|
394 |
+
maxlength="200"
|
395 |
+
bind:textContent={strength}
|
396 |
+
on:keydown={onKeyDown}
|
397 |
+
/>
|
398 |
+
</div>
|
399 |
<div class="flex gap-x-2 mt-3 items-start justify-center {isLoading ? 'animate-pulse' : ''}">
|
400 |
<span
|
401 |
class="overflow-auto resize-y py-2 px-3 min-h-[42px] max-h-[500px] !w-[181px] whitespace-pre-wrap inline-block border border-gray-200 shadow-inner outline-none"
|
|
|
404 |
style="--placeholder: 'Add prompt'"
|
405 |
spellcheck="false"
|
406 |
dir="auto"
|
407 |
+
maxlength="1000"
|
408 |
bind:textContent={txt}
|
409 |
on:keydown={onKeyDown}
|
410 |
/>
|
411 |
<button
|
412 |
on:click={submitRequest}
|
413 |
+
class="bg-green-700 hover:bg-green-800 text-white font-bold py-[0.555rem] px-4 rounded-xl"
|
414 |
>
|
415 |
diffuse 🪄
|
416 |
</button>
|