bg_remover_index.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. {% load static %}
  2. <!DOCTYPE html>
  3. <html lang="en">
  4. <head>
  5. <meta charset="UTF-8">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Background Remover</title>
  8. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
  9. <script src="https://unpkg.com/xlsx/dist/xlsx.full.min.js"></script>
  10. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/source-sans-3@5.0.12/index.css"
  11. integrity="sha256-tXJfXfp6Ewt1ilPzLDtQnJV4hclT9XuaZUKyUvmyr+Q=" crossorigin="anonymous">
  12. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.3.0/styles/overlayscrollbars.min.css"
  13. integrity="sha256-dSokZseQNT08wYEWiz5iLI8QPlKxG+TswNRD8k35cpg=" crossorigin="anonymous">
  14. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.min.css"
  15. integrity="sha256-Qsx5lrStHZyR9REqhUF8iQt73X06c8LGIUPzpOhwRrI=" crossorigin="anonymous">
  16. <link rel="stylesheet" href="{% static './css/adminlte.css' %}">
  17. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@3.37.1/dist/apexcharts.css"
  18. integrity="sha256-4MX+61mt9NVvvuPjUWdUdyfZfxSB1/Rf9WtqRHgG5S0=" crossorigin="anonymous">
  19. <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
  20. <link rel="stylesheet" href="{% static './css/select2-bootstrap4.min.css' %}">
  21. <link rel="stylesheet" href="{% static './css/custom.css' %}">
  22. <script src="https://cdn.tailwindcss.com"></script>
  23. <style>
  24. .bg-remover-container .nav-pills .nav-link { color: #64748b; font-weight: 600; border-radius: 12px; padding: 10px 25px; transition: all 0.3s; border: none; background: none; }
  25. .bg-remover-container .nav-pills .nav-link.active { background-color: #3b82f6 !important; color: white !important; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }
  26. .bg-remover-container .upload-card { transition: all 0.3s ease; border: 2px dashed #cbd5e1; background: #ffffff; }
  27. .upload-card:hover { border-color: #3b82f6; background-color: #f8fafc; transform: translateY(-2px); }
  28. .preview-box { background: #ffffff; border-radius: 12px; padding: 15px; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }
  29. .checkerboard-bg {
  30. background-image: linear-gradient(45deg, #eee 25%, transparent 25%), linear-gradient(-45deg, #eee 25%, transparent 25%),
  31. linear-gradient(45deg, transparent 75%, #eee 75%), linear-gradient(-45deg, transparent 75%, #eee 75%);
  32. background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  33. }
  34. </style>
  35. </head>
  36. <body class="layout-fixed sidebar-expand-lg sidebar-mini app-loaded sidebar-collapse">
  37. <div class="app-wrapper">
  38. {% include 'header.html' %}
  39. {% include 'sidebar.html' %}
  40. <main class="app-main">
  41. <div class="app-content-header">
  42. <div class="container-fluid">
  43. <div class="row">
  44. <div class="col-sm-6">
  45. <h3 class="mb-0">🪄 Image Background Remover</h3>
  46. </div>
  47. <div class="col-sm-6">
  48. <ol class="breadcrumb float-sm-end">
  49. <li class="breadcrumb-item"><a href="{% url 'file-upload' %}">Home</a></li>
  50. <li class="breadcrumb-item active" aria-current="page"><a href="{% url 'product-attributes' %}"></a>
  51. 🪄 Image Background Remover</a>
  52. </li>
  53. </ol>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. <div class="app-content pt-10 bg-remover-container">
  59. <div class="mx-auto px-4">
  60. <div class="mb-10 flex flex-col md:flex-row md:items-end md:justify-between gap-4 border-b border-gray-100 pb-6">
  61. <div class="text-left">
  62. <h1 class="text-4xl font-black text-gray-900 tracking-tight mb-2">
  63. Image <span class="text-blue-600">Background</span> Remover
  64. </h1>
  65. <p class="text-gray-500 font-medium ">
  66. Professional-grade background removal. Process single images or
  67. <span class="text-gray-800 font-semibold">batch process ZIP archives </span> instantly.
  68. </p>
  69. </div>
  70. <div class="flex items-center">
  71. <a href="/bg-remover/tasks/history/"
  72. class="inline-flex items-center gap-2 px-5 py-2.5 bg-white border border-gray-200 text-gray-700 text-sm font-bold rounded-xl shadow-sm hover:shadow-md hover:border-blue-300 hover:text-blue-600 transition-all duration-200 group">
  73. <i class="bi bi-clock-history text-gray-400 group-hover:text-blue-500 transition-colors"></i>
  74. Task History
  75. <span class="flex h-2 w-2 rounded-full bg-blue-500 ml-1"></span>
  76. </a>
  77. </div>
  78. </div>
  79. <ul class="nav nav-pills justify-content-center mb-8 gap-3" id="pills-tab" role="tablist">
  80. <li class="nav-item" role="presentation">
  81. <button class="nav-link active" id="pills-single-tab" data-bs-toggle="pill" data-bs-target="#pills-single" type="button" role="tab">
  82. <i class="bi bi-image mr-2"></i> Single Image
  83. </button>
  84. </li>
  85. <li class="nav-item" role="presentation">
  86. <button class="nav-link" id="pills-bulk-tab" data-bs-toggle="pill" data-bs-target="#pills-bulk" type="button" role="tab">
  87. <i class="bi bi-images mr-2"></i> Bulk & ZIP Process
  88. </button>
  89. </li>
  90. </ul>
  91. <div class="tab-content" id="pills-tabContent">
  92. <!-- NEW: Choose Action -->
  93. <!-- SINGLE IMAGE TAB -->
  94. <div class="tab-pane fade show active" id="pills-single" role="tabpanel">
  95. <div class="mt-6 flex justify-center gap-6">
  96. <label class="inline-flex items-center gap-2">
  97. <input type="radio" name="action" value="remove_bg" checked>
  98. <span>Remove Background</span>
  99. </label>
  100. <label class="inline-flex items-center gap-2">
  101. <input type="radio" name="action" value="caption">
  102. <span>Generate Caption</span>
  103. </label>
  104. </div>
  105. <div id="uploadContainer" class="bg-white p-8 rounded-3xl shadow-sm border border-gray-200 mb-8">
  106. <div id="drop-zone" class="upload-card flex flex-col items-center justify-center rounded-2xl p-12 cursor-pointer" onclick="document.getElementById('file-input').click()">
  107. <input type="file" id="file-input" class="hidden" accept="image/*">
  108. <div class="bg-blue-50 p-5 rounded-full mb-4 text-blue-600">
  109. <i class="bi bi-cloud-arrow-up text-4xl"></i>
  110. </div>
  111. <p class="text-lg font-semibold text-gray-700">Click or Drag & Drop Image</p>
  112. <p class="text-sm text-gray-400 mt-1">Supports PNG, JPG, WEBP</p>
  113. </div>
  114. </div>
  115. <!-- RESULTS -->
  116. <div id="result-container" class="hidden space-y-8 pb-20">
  117. <div class="grid grid-cols-1 md:grid-cols-2 gap-8">
  118. <div class="space-y-3">
  119. <span class="text-xs font-bold uppercase text-gray-400 tracking-wider">Original</span>
  120. <div class="preview-box"><img id="original-preview" class="rounded-lg w-full h-auto object-contain max-h-[400px]"></div>
  121. </div>
  122. <div class="space-y-3">
  123. <div class="flex justify-between items-center px-1">
  124. <span class="text-xs font-bold uppercase text-gray-400 tracking-wider">Processed</span>
  125. <span id="processing-badge" class="hidden animate-pulse bg-blue-100 text-blue-700 px-2 py-0.5 rounded text-[10px] font-bold">PROCESSING...</span>
  126. </div>
  127. <div class="preview-box relative min-h-[200px] flex items-center justify-center checkerboard-bg rounded-lg p-4">
  128. <div id="result-loader" class="absolute inset-0 bg-white/60 backdrop-blur-sm flex flex-col items-center justify-center rounded-lg z-10 hidden">
  129. <div class="w-10 h-10 border-4 border-blue-600 border-t-transparent rounded-full animate-spin"></div>
  130. </div>
  131. <!-- Image element -->
  132. <img id="processed-preview" class="rounded-lg w-full h-auto object-contain max-h-[400px]">
  133. <!-- Caption element -->
  134. <div id="caption-text" class="hidden text-center text-gray-800 font-semibold text-lg"></div>
  135. </div>
  136. </div>
  137. <!-- <div class="space-y-3">
  138. <div class="flex justify-between items-center px-1">
  139. <span class="text-xs font-bold uppercase text-gray-400 tracking-wider">Processed</span>
  140. <span id="processing-badge" class="hidden animate-pulse bg-blue-100 text-blue-700 px-2 py-0.5 rounded text-[10px] font-bold">PROCESSING...</span>
  141. </div>
  142. <div class="preview-box relative min-h-[200px] flex items-center justify-center checkerboard-bg rounded-lg">
  143. <div id="result-loader" class="absolute inset-0 bg-white/60 backdrop-blur-sm flex flex-col items-center justify-center rounded-lg z-10 hidden">
  144. <div class="w-10 h-10 border-4 border-blue-600 border-t-transparent rounded-full animate-spin"></div>
  145. </div>
  146. <img id="processed-preview" class="rounded-lg w-full h-auto object-contain max-h-[400px]">
  147. </div>
  148. </div> -->
  149. </div>
  150. <!-- NEW CAPTION SECTION -->
  151. <div id="caption-container" class="hidden mt-4 text-center">
  152. <h3 class="text-lg font-semibold text-gray-700">AI Generated Caption:</h3>
  153. <p id="caption-text-below" class="text-blue-600 font-bold text-xl mt-1"></p>
  154. </div>
  155. <div class="flex gap-3 justify-center mt-4">
  156. <button onclick="location.reload()" class="px-6 py-2 bg-gray-100 rounded-xl font-bold hover:bg-gray-200">New Upload</button>
  157. <a id="download-btn" class="hidden px-8 py-2 bg-green-600 text-white rounded-xl font-bold shadow-lg hover:bg-green-700">Download PNG</a>
  158. </div>
  159. </div>
  160. </div>
  161. <!-- BULK TAB -->
  162. <div class="tab-pane fade" id="pills-bulk" role="tabpanel">
  163. <div class="mb-6 flex justify-center gap-6">
  164. <label class="inline-flex items-center gap-2">
  165. <input type="radio" name="bulk-action" value="remove_bg" checked>
  166. <span class="font-semibold text-gray-700">Bulk Remove Background</span>
  167. </label>
  168. <label class="inline-flex items-center gap-2">
  169. <input type="radio" name="bulk-action" value="caption">
  170. <span class="font-semibold text-gray-700">Bulk Generate Caption</span>
  171. </label>
  172. </div>
  173. <div class="bg-white p-8 rounded-3xl shadow-sm border border-gray-200 mb-8">
  174. <div id="bulk-drop-zone" class="upload-card flex flex-col items-center justify-center rounded-2xl p-12 cursor-pointer transition-all border-indigo-200" onclick="document.getElementById('bulk-file-input').click()">
  175. <input type="file" id="bulk-file-input" class="hidden" accept="image/*,.zip" multiple>
  176. <div class="bg-indigo-50 p-5 rounded-full mb-4 text-indigo-600">
  177. <i class="bi bi-file-earmark-zip text-4xl"></i>
  178. </div>
  179. <h3 class="text-xl font-bold text-gray-800">Bulk & ZIP Upload</h3>
  180. <p class="text-gray-500 mt-1 text-center">Upload multiple images or a <b>single ZIP file</b></p>
  181. </div>
  182. <div id="bulk-list-container" class="hidden mt-8 border-t pt-8">
  183. <div class="flex justify-between items-center mb-6">
  184. <div>
  185. <h3 class="font-extrabold text-gray-900 text-lg">Batch Queue</h3>
  186. <p class="text-xs text-gray-400 uppercase font-bold tracking-widest"><span id="file-count">0</span> Items Ready</p>
  187. </div>
  188. <button id="start-bulk-btn" class="bg-indigo-600 text-white px-8 py-3 rounded-xl font-bold hover:bg-indigo-700 shadow-lg">Start Processing</button>
  189. </div>
  190. <div id="file-queue" class="grid grid-cols-2 sm:grid-cols-4 md:grid-cols-6 gap-4"></div>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. <div id="bulk-loader" class="hidden fixed inset-0 bg-black/60 backdrop-blur-md z-[9999] flex flex-col items-center justify-center text-white">
  198. <div class="flex flex-col items-center p-8 bg-gray-900/80 rounded-3xl border border-white/10 shadow-2xl">
  199. <div class="w-16 h-16 border-4 border-indigo-500 border-t-transparent rounded-full animate-spin mb-4"></div>
  200. <h2 class="text-2xl font-bold">Processing Batch...</h2>
  201. <p class="text-gray-400 mt-2">AI is removing backgrounds and preparing your ZIP.</p>
  202. <p class="text-xs text-indigo-400 mt-4 uppercase tracking-widest font-bold">Please do not refresh the page</p>
  203. </div>
  204. </div>
  205. </main>
  206. {% include 'footer.html' %}
  207. </div>
  208. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  209. <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"></script>
  210. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js"></script>
  211. <script src="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.3.0/browser/overlayscrollbars.browser.es6.min.js"></script>
  212. <script src="{% static './js/adminlte.js' %}"></script>
  213. <script>
  214. // SINGLE IMAGE UPLOAD + CAPTION
  215. const fileInput = document.getElementById('file-input');
  216. if (fileInput) {
  217. fileInput.onchange = (e) => handleSingleUpload(e.target.files[0]);
  218. }
  219. // async function handleSingleUpload(file) {
  220. // if (!file) return;
  221. // document.getElementById('uploadContainer').classList.add('hidden');
  222. // document.getElementById('result-container').classList.remove('hidden');
  223. // document.getElementById('result-loader').classList.remove('hidden');
  224. // document.getElementById('original-preview').src = URL.createObjectURL(file);
  225. // const formData = new FormData();
  226. // formData.append('image', file);
  227. // try {
  228. // // --- REMOVE BG ---
  229. // const response = await fetch('/bg-remover/remove-bg/', {
  230. // method: 'POST',
  231. // body: formData,
  232. // headers: {'X-CSRFToken': '{{ csrf_token }}'}
  233. // });
  234. // if (!response.ok) throw new Error("Processing failed");
  235. // const blob = await response.blob();
  236. // const url = URL.createObjectURL(blob);
  237. // document.getElementById('processed-preview').src = url;
  238. // const btn = document.getElementById('download-btn');
  239. // btn.href = url;
  240. // btn.download = `cleared_${file.name.split('.')[0]}.png`;
  241. // btn.classList.remove('hidden');
  242. // // --- GET CAPTION ---
  243. // const captionResp = await fetch('/bg-remover/caption/', {
  244. // method: 'POST',
  245. // body: formData,
  246. // headers: {'X-CSRFToken': '{{ csrf_token }}'}
  247. // });
  248. // if (captionResp.ok) {
  249. // const data = await captionResp.json();
  250. // document.getElementById('caption-text').innerText = data.caption;
  251. // document.getElementById('caption-container').classList.remove('hidden');
  252. // }
  253. // } catch (err) {
  254. // alert("Error processing image: " + err.message);
  255. // location.reload();
  256. // } finally {
  257. // document.getElementById('result-loader').classList.add('hidden');
  258. // }
  259. // }
  260. async function handleSingleUpload(file) {
  261. if (!file) return;
  262. const selectedAction = document.querySelector('input[name="action"]:checked').value;
  263. document.getElementById('uploadContainer').classList.add('hidden');
  264. document.getElementById('result-container').classList.remove('hidden');
  265. document.getElementById('result-loader').classList.remove('hidden');
  266. document.getElementById('original-preview').src = URL.createObjectURL(file);
  267. const formData = new FormData();
  268. formData.append('image', file);
  269. try {
  270. if (selectedAction === 'remove_bg') {
  271. // --- REMOVE BG ---
  272. const response = await fetch('/bg-remover/remove-bg/', {
  273. method: 'POST',
  274. body: formData,
  275. headers: {'X-CSRFToken': '{{ csrf_token }}'}
  276. });
  277. if (!response.ok) throw new Error("Background removal failed");
  278. const blob = await response.blob();
  279. const url = URL.createObjectURL(blob);
  280. document.getElementById('processed-preview').src = url;
  281. document.getElementById('processed-preview').classList.remove('hidden');
  282. document.getElementById('caption-text').classList.add('hidden');
  283. const btn = document.getElementById('download-btn');
  284. btn.href = url;
  285. btn.download = `cleared_${file.name.split('.')[0]}.png`;
  286. btn.classList.remove('hidden');
  287. document.getElementById('caption-container').classList.add('hidden'); // hide caption
  288. document.getElementById('caption-text-below').classList.add('hidden'); // hide caption
  289. } else if (selectedAction === 'caption') {
  290. // --- GENERATE CAPTION ---
  291. const captionResp = await fetch('/bg-remover/caption/', {
  292. method: 'POST',
  293. body: formData,
  294. headers: {'X-CSRFToken': '{{ csrf_token }}'}
  295. });
  296. if (!captionResp.ok) throw new Error("Caption generation failed");
  297. const data = await captionResp.json();
  298. document.getElementById('caption-text').innerText = data.caption;
  299. document.getElementById('caption-container').classList.remove('hidden');
  300. document.getElementById('caption-text-below').classList.remove('hidden');
  301. document.getElementById('caption-text').classList.remove('hidden');
  302. document.getElementById('processed-preview').classList.add('hidden');
  303. document.getElementById('download-btn').classList.add('hidden');
  304. // document.getElementById('processed-preview').src = ''; // no image
  305. // document.getElementById('download-btn').classList.add('hidden');
  306. }
  307. } catch (err) {
  308. alert("Error: " + err.message);
  309. location.reload();
  310. } finally {
  311. document.getElementById('result-loader').classList.add('hidden');
  312. }
  313. }
  314. // BULK LOGIC PRESERVED
  315. const bulkInput = document.getElementById('bulk-file-input');
  316. const fileQueue = document.getElementById('file-queue');
  317. const bulkList = document.getElementById('bulk-list-container');
  318. const startBulkBtn = document.getElementById('start-bulk-btn');
  319. const bulkLoader = document.getElementById('bulk-loader');
  320. if (bulkInput) {
  321. bulkInput.onchange = (e) => {
  322. const files = Array.from(e.target.files);
  323. if (files.length === 0) return;
  324. bulkList.classList.remove('hidden');
  325. document.getElementById('file-count').innerText = files.length;
  326. fileQueue.innerHTML = '';
  327. files.forEach(file => {
  328. const div = document.createElement('div');
  329. div.className = "relative bg-gray-50 rounded-xl border border-gray-100 p-2 text-center";
  330. if (file.name.toLowerCase().endsWith('.zip')) {
  331. div.innerHTML = `<div class="aspect-square flex flex-col items-center justify-center text-indigo-500"><i class="bi bi-file-earmark-zip-fill text-4xl"></i><span class="text-[10px] font-bold mt-1 truncate w-full px-2">${file.name}</span></div>`;
  332. } else {
  333. const reader = new FileReader();
  334. reader.onload = (event) => {
  335. div.innerHTML = `<div class="aspect-square rounded-lg overflow-hidden bg-white mb-1"><img src="${event.target.result}" class="w-full h-full object-cover"></div><span class="text-[9px] font-bold text-gray-400 truncate block">${file.name}</span>`;
  336. };
  337. reader.readAsDataURL(file);
  338. }
  339. fileQueue.appendChild(div);
  340. });
  341. };
  342. }
  343. if (startBulkBtn) {
  344. startBulkBtn.onclick = async () => {
  345. const files = bulkInput.files;
  346. if (!files.length) return;
  347. // 1. Identify which action is selected for bulk
  348. const selectedAction = document.querySelector('input[name="bulk-action"]:checked').value;
  349. const formData = new FormData();
  350. // Use 'images' as the key to match your single image logic/backend expectation
  351. for (let i = 0; i < files.length; i++) {
  352. formData.append('images', files[i]);
  353. }
  354. const loader = document.getElementById('bulk-loader');
  355. const loaderTitle = loader.querySelector('h2');
  356. const loaderSub = loader.querySelector('p');
  357. // Update loader text based on action
  358. if (selectedAction === 'caption') {
  359. loaderTitle.innerText = "Generating Captions...";
  360. loaderSub.innerText = "AI is describing your images and preparing a report.";
  361. } else {
  362. loaderTitle.innerText = "Processing Batch...";
  363. loaderSub.innerText = "AI is removing backgrounds and preparing your ZIP.";
  364. }
  365. loader.classList.remove('hidden');
  366. try {
  367. // 2. Determine URL based on action
  368. const endpoint = selectedAction === 'caption'
  369. ? '/bg-remover/caption/bulk/'
  370. : '/bg-remover/remove-bg/bulk/';
  371. const response = await fetch(endpoint, {
  372. method: 'POST',
  373. body: formData,
  374. headers: {'X-CSRFToken': '{{ csrf_token }}'}
  375. });
  376. if (response.ok) {
  377. const data = await response.json();
  378. if (selectedAction === 'caption') {
  379. // If your caption bulk returns an Excel or CSV file
  380. if (data.file_url) {
  381. window.location.href = data.file_url;
  382. } else {
  383. alert("Captions generated successfully. Check Task History.");
  384. }
  385. } else {
  386. // Standard ZIP download for background removal
  387. window.location.href = data.zip_url;
  388. }
  389. } else {
  390. const errorData = await response.json();
  391. alert("Batch processing failed: " + (errorData.error || "Unknown error"));
  392. }
  393. } catch(err) {
  394. console.error(err);
  395. alert("An error occurred during batch processing.");
  396. } finally {
  397. loader.classList.add('hidden');
  398. }
  399. };
  400. }
  401. // if (startBulkBtn) {
  402. // startBulkBtn.onclick = async () => {
  403. // const files = bulkInput.files;
  404. // if (!files.length) return;
  405. // const formData = new FormData();
  406. // for (let i = 0; i < files.length; i++) formData.append('images', files[i]);
  407. // document.getElementById('bulk-loader').classList.remove('hidden');
  408. // try {
  409. // const response = await fetch('/bg-remover/remove-bg/bulk/', {
  410. // method: 'POST',
  411. // body: formData,
  412. // headers: {'X-CSRFToken': '{{ csrf_token }}'}
  413. // });
  414. // if (response.ok) {
  415. // window.location.href = await response.json().then(data => data.zip_url);
  416. // } else { alert("Batch processing failed."); }
  417. // } catch(err) { alert(err); }
  418. // finally { bulkLoader.classList.add('hidden'); }
  419. // };
  420. // }
  421. </script>
  422. </body>
  423. </html>