Spaces:
Running
Running
dgbkn
commited on
Commit
·
7e7d725
1
Parent(s):
a21ebb4
done
Browse files- static/pill_upload.html +24 -0
- static/wheat_upload.html +22 -0
static/pill_upload.html
CHANGED
@@ -23,10 +23,34 @@
|
|
23 |
<body class="flex flex-col items-center justify-center h-screen bg-gray-100">
|
24 |
<h1 class="text-2xl font-bold mb-4">Upload an Image</h1>
|
25 |
<input type="file" id="fileInput" accept="image/*" capture="environment" class="hidden">
|
|
|
|
|
|
|
|
|
26 |
<img src="/upload.png" alt="Click to Upload" class="clickable-image mb-4" onclick="triggerFileInput()">
|
|
|
|
|
27 |
<button onclick="uploadImage()" class="bg-blue-500 text-white px-4 py-2 rounded">Upload</button>
|
28 |
<div id="output" class="mt-4"></div>
|
29 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
function triggerFileInput() {
|
31 |
document.getElementById('fileInput').click();
|
32 |
}
|
|
|
23 |
<body class="flex flex-col items-center justify-center h-screen bg-gray-100">
|
24 |
<h1 class="text-2xl font-bold mb-4">Upload an Image</h1>
|
25 |
<input type="file" id="fileInput" accept="image/*" capture="environment" class="hidden">
|
26 |
+
|
27 |
+
<button id="cameraButton">Take Photo</button>
|
28 |
+
<button id="galleryButton">Choose from Gallery</button>
|
29 |
+
|
30 |
<img src="/upload.png" alt="Click to Upload" class="clickable-image mb-4" onclick="triggerFileInput()">
|
31 |
+
|
32 |
+
|
33 |
<button onclick="uploadImage()" class="bg-blue-500 text-white px-4 py-2 rounded">Upload</button>
|
34 |
<div id="output" class="mt-4"></div>
|
35 |
<script>
|
36 |
+
|
37 |
+
document.addEventListener('DOMContentLoaded', function() {
|
38 |
+
const fileInput = document.getElementById('fileInput');
|
39 |
+
const cameraButton = document.getElementById('cameraButton');
|
40 |
+
const galleryButton = document.getElementById('galleryButton');
|
41 |
+
|
42 |
+
cameraButton.addEventListener('click', function() {
|
43 |
+
fileInput.setAttribute('capture', 'environment');
|
44 |
+
fileInput.click();
|
45 |
+
});
|
46 |
+
|
47 |
+
galleryButton.addEventListener('click', function() {
|
48 |
+
fileInput.removeAttribute('capture');
|
49 |
+
fileInput.click();
|
50 |
+
});
|
51 |
+
|
52 |
+
});
|
53 |
+
|
54 |
function triggerFileInput() {
|
55 |
document.getElementById('fileInput').click();
|
56 |
}
|
static/wheat_upload.html
CHANGED
@@ -23,6 +23,10 @@
|
|
23 |
<body class="flex flex-col items-center justify-center h-screen bg-gray-100">
|
24 |
<h1 class="text-2xl font-bold mb-4">Upload an Image</h1>
|
25 |
<input type="file" id="fileInput" accept="image/*" capture="environment" class="hidden">
|
|
|
|
|
|
|
|
|
26 |
<img src="/upload.png" alt="Click to Upload" class="clickable-image mb-4" onclick="triggerFileInput()">
|
27 |
|
28 |
<!-- Dropdown for selecting model_id -->
|
@@ -35,6 +39,24 @@
|
|
35 |
<div id="output" class="mt-4"></div>
|
36 |
|
37 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
function triggerFileInput() {
|
39 |
document.getElementById('fileInput').click();
|
40 |
}
|
|
|
23 |
<body class="flex flex-col items-center justify-center h-screen bg-gray-100">
|
24 |
<h1 class="text-2xl font-bold mb-4">Upload an Image</h1>
|
25 |
<input type="file" id="fileInput" accept="image/*" capture="environment" class="hidden">
|
26 |
+
|
27 |
+
<button id="cameraButton">Take Photo</button>
|
28 |
+
<button id="galleryButton">Choose from Gallery</button>
|
29 |
+
|
30 |
<img src="/upload.png" alt="Click to Upload" class="clickable-image mb-4" onclick="triggerFileInput()">
|
31 |
|
32 |
<!-- Dropdown for selecting model_id -->
|
|
|
39 |
<div id="output" class="mt-4"></div>
|
40 |
|
41 |
<script>
|
42 |
+
|
43 |
+
document.addEventListener('DOMContentLoaded', function() {
|
44 |
+
const fileInput = document.getElementById('fileInput');
|
45 |
+
const cameraButton = document.getElementById('cameraButton');
|
46 |
+
const galleryButton = document.getElementById('galleryButton');
|
47 |
+
|
48 |
+
cameraButton.addEventListener('click', function() {
|
49 |
+
fileInput.setAttribute('capture', 'environment');
|
50 |
+
fileInput.click();
|
51 |
+
});
|
52 |
+
|
53 |
+
galleryButton.addEventListener('click', function() {
|
54 |
+
fileInput.removeAttribute('capture');
|
55 |
+
fileInput.click();
|
56 |
+
});
|
57 |
+
|
58 |
+
});
|
59 |
+
|
60 |
function triggerFileInput() {
|
61 |
document.getElementById('fileInput').click();
|
62 |
}
|