File size: 1,417 Bytes
7d0aab4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<html><head><link href="https://cdn.jsdelivr.net/npm/daisyui@3.1.6/dist/full.css" rel="stylesheet" type="text/css" /><script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script><script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"></script><script defer src="https://cdnjs.cloudflare.com/ajax/libs/three.js/0.156.1/three.min.js"></script><script type="module" src="main.js"></script><title>Image2Image</title></head><body><main class="prose" x-data="{ load: false, message: 'Loading...', processing: false, sourceImage: null, outputImage: null }" x-effect="if (!load) { message = 'Loading...'; processing = true; fetch('/image/input').then(response => response.ok ? response.json() : {}) }">
<div class="flex items-center justify-center">
 <div class="mb-4">
    <input type="file" class="block w-full" x-ref="sourceImageInput" x-on:change="fileSelected" />
 </div>
 <div x-show="message.length" class="mb-4 text-xs text-gray-600">
    {{ message }}
 </div>
 <div x-show="outputImage" x-on:click="download" class="px-2 py-2 mb-4 text-xs text-white font-bold rounded-md bg-black border shadow-md text-center">
    {{ outputImage ? outputImage : 'Click to Download' }}
 </div>
 <button type="button" x-show="sourceImage" x-on:click="processImage" class="px-4 py-2 font-bold rounded-md bg-black border shadow-md">Process Image</button>
</div>
</main>
</body></html>