{ let reader = new FileReader(); reader.onload = (event) => { let originalImageUrl = `${event.target.result}`; const img = new Image(); img.src = originalImageUrl; img.onload = function () { const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); // Set canvas dimensions to the original image dimensions canvas.width = img.width; canvas.height = img.height; // Draw the original image on the canvas ctx.drawImage(img, 0, 0); // Get the base64 representation of the compressed image const compressedSrc = canvas.toDataURL('image/jpeg', 0.1); // Display the compressed image imageUrl = compressedSrc; inputFiles = null; }; }; if ( inputFiles && inputFiles.length > 0 && ['image/gif', 'image/jpeg', 'image/png'].includes(inputFiles[0]['type']) ) { reader.readAsDataURL(inputFiles[0]); } else { console.log(`Unsupported File Type '${inputFiles[0]['type']}'.`); inputFiles = null; } }} />
My Modelfiles
{ history.back(); }} >
Back
{ submitHandler(); }} >
{ filesInputElement.click(); }} > {#if imageUrl}
{:else}
{/if}
Name*
Description*
Modelfile
{ raw = !raw; }} > {#if raw}
Raw Format
{:else}
Builder Mode
{/if}
{#if raw}
Content*
Not sure what to write? Switch to
{ raw = !raw; }}>Builder Mode
or
Click here to check other modelfiles.
{:else}
From (Base Model)*
To access the available model names for downloading,
click here.
System Prompt
Modelfile Advanced Settings
{ advanced = !advanced; }} > {#if advanced}
Custom
{:else}
Default
{/if}
{#if advanced}
Template
Parameters
{/if} {/if}
Prompt suggestions
{ suggestions = [...suggestions, { content: '' }]; }} >
{#each suggestions as prompt, promptIdx}
{ suggestions.splice(promptIdx, 1); suggestions = suggestions; }} >
{/each}
Categories
{#each Object.keys(categories) as category}
{category}
{/each}
{#if pullProgress !== null}
Pull Progress
{pullProgress ?? 0}%
{digest}
{/if}
Save & Create
{#if loading}
{/if}