Spaces:
Running
Running
Delete templates
Browse files- templates/index.html +0 -101
templates/index.html
DELETED
@@ -1,101 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html>
|
3 |
-
|
4 |
-
<head>
|
5 |
-
<title>Image Background Remover</title>
|
6 |
-
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style/style.css') }}">
|
7 |
-
</head>
|
8 |
-
|
9 |
-
<body>
|
10 |
-
<h1>Image Background Remover</h1>
|
11 |
-
|
12 |
-
<div id="dropArea" class="drop-area" ondrop="dropHandler(event);" ondragover="dragOverHandler(event);">
|
13 |
-
<p>Drag and drop image files here to upload</p>
|
14 |
-
</div>
|
15 |
-
|
16 |
-
<div id="fileNamesBox" class="file-names-box"></div>
|
17 |
-
|
18 |
-
<form action="/" method="post" enctype="multipart/form-data">
|
19 |
-
<label for="fileInput" class="file-input-label"></label>
|
20 |
-
<input type="file" name="images" id="fileInput" multiple accept=".jpg,.png" required class="file-input"
|
21 |
-
onchange="displayFileNames(this)">
|
22 |
-
<input type="submit" value="Remove Background" onclick="showProcessingMessage()" class="remove-background-button">
|
23 |
-
</form>
|
24 |
-
|
25 |
-
<div id="processingMessage" class="hidden blink">
|
26 |
-
<p>Wait, Removing Background...</p>
|
27 |
-
</div>
|
28 |
-
|
29 |
-
{% if processed %}
|
30 |
-
<div>
|
31 |
-
<p>Image(s) processed successfully!</p>
|
32 |
-
{% if num_files > 1 %}
|
33 |
-
<button class="download-button" onclick="downloadZip('{{ zip_filename }}')">Download Zip (HD)</button>
|
34 |
-
{% else %}
|
35 |
-
<button class="download-button" onclick="downloadImage('{{ filename }}')">Download Image HD</button>
|
36 |
-
{% endif %}
|
37 |
-
</div>
|
38 |
-
{% endif %}
|
39 |
-
|
40 |
-
{% if error %}
|
41 |
-
<div>
|
42 |
-
<p>{{ error }}</p>
|
43 |
-
</div>
|
44 |
-
{% endif %}
|
45 |
-
|
46 |
-
<script>
|
47 |
-
function dragOverHandler(event) {
|
48 |
-
event.preventDefault();
|
49 |
-
document.getElementById('dropArea').style.backgroundColor = '#f7f7f7';
|
50 |
-
}
|
51 |
-
|
52 |
-
function dropHandler(event) {
|
53 |
-
event.preventDefault();
|
54 |
-
document.getElementById('dropArea').style.backgroundColor = '#fff';
|
55 |
-
|
56 |
-
var files = event.dataTransfer.files;
|
57 |
-
var input = document.getElementById('fileInput');
|
58 |
-
input.files = files;
|
59 |
-
displayFileNames(input);
|
60 |
-
}
|
61 |
-
|
62 |
-
function displayFileNames(input) {
|
63 |
-
var fileNamesBox = document.getElementById('fileNamesBox');
|
64 |
-
fileNamesBox.innerText = '';
|
65 |
-
|
66 |
-
if (input.files.length > 0) {
|
67 |
-
var fileNames = [];
|
68 |
-
for (var i = 0; i < input.files.length; i++) {
|
69 |
-
fileNames.push(input.files[i].name);
|
70 |
-
}
|
71 |
-
fileNamesBox.innerText = 'Selected Files: ' + fileNames.join(', ');
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
function showProcessingMessage() {
|
76 |
-
var input = document.getElementById('fileInput');
|
77 |
-
if (input.files.length === 0) {
|
78 |
-
var errorMessage = document.createElement('p');
|
79 |
-
errorMessage.innerText = 'Select at least one image.';
|
80 |
-
var errorContainer = document.createElement('div');
|
81 |
-
errorContainer.appendChild(errorMessage);
|
82 |
-
document.body.appendChild(errorContainer);
|
83 |
-
} else {
|
84 |
-
var processingMessage = document.getElementById('processingMessage');
|
85 |
-
processingMessage.classList.remove('hidden');
|
86 |
-
}
|
87 |
-
}
|
88 |
-
|
89 |
-
function downloadImage(filename) {
|
90 |
-
var outputFilename = filename.split('.')[0] + '.png';
|
91 |
-
window.location.href = '/download/' + outputFilename;
|
92 |
-
}
|
93 |
-
|
94 |
-
function downloadZip(zipFilename) {
|
95 |
-
window.location.href = '/download/' + zipFilename;
|
96 |
-
}
|
97 |
-
</script>
|
98 |
-
</body>
|
99 |
-
|
100 |
-
</html>
|
101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|