-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
111 lines (110 loc) · 4.04 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html>
<head>
<title>🐪🕶️ LLamaLens</title>
<style>
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
max-width: 900px;
margin: 10px auto;
padding: 10px;
background-color: #f3f4f6;
color: #333;
}
h1 {
text-align: center;
color: #444;
font-size: 24px;
}
.intro-text {
text-align: center;
font-size: 16px;
margin-top: 20px;
color: #555;
}
form {
background-color: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
text-align: center;
margin-top: 20px;
}
input[type="file"] {
border: 2px solid #ddd;
padding: 10px;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"] {
background-color: blue;
color: white;
border: none;
padding: 10px 20px;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
margin-top: 10px;
}
input[type="submit"]:hover {
background-color: #4cae4c;
}
.example-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-gap: 15px;
justify-content: center;
margin-top: 30px;
}
.example-photo {
width: 100%;
height: 250px;
object-fit: cover;
border-radius: 4px;
transition: transform 0.3s ease-in-out;
}
.example-photo:hover {
transform: scale(1.05);
box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.example-photo.selected {
border: 4px solid #27CE4D;
}
</style>
</head>
<body>
<h1> 📷 Upload Photo -> 🔄 Process Image -> 💬 Generate Caption</h1>
<p class="intro-text">Upload a photo, or choose an example below, and LLamaLens will write an informative caption for you!</p>
<form action="/upload" method="POST" enctype="multipart/form-data">
<input type="file" name="photo" accept=".jpg,.jpeg" onchange="fileSelected()">
<input type="hidden" name="example_photo" id="example_photo">
<input type="submit" value="Generate Captions">
</form>
<div class="example-container">
<img class="example-photo" src="{{ url_for('static', filename='easter.jpg') }}" alt="Easter Island" onclick="selectPhoto(this)">
<img class="example-photo" src="{{ url_for('static', filename='NYC.jpeg') }}" alt="NYC" onclick="selectPhoto(this)">
<img class="example-photo" src="{{ url_for('static', filename='buenosaires.jpeg') }}" alt="Buenos Aires" onclick="selectPhoto(this)">
<img class="example-photo" src="{{ url_for('static', filename='rio.jpg') }}" alt="Rio" onclick="selectPhoto(this)">
<img class="example-photo" src="{{ url_for('static', filename='buenos.jpeg') }}" alt="Another View" onclick="selectPhoto(this)">
<img class="example-photo" src="{{ url_for('static', filename='rapanui.jpeg') }}" alt="Another View" onclick="selectPhoto(this)">
</div>
<script>
function selectPhoto(element) {
const selectedPhoto = document.querySelector('.example-photo.selected');
if (selectedPhoto) {
selectedPhoto.classList.remove('selected');
}
element.classList.add('selected');
document.getElementById('example_photo').value = element.src;
document.querySelector('input[name="photo"]').value = '';
}
function fileSelected() {
const selectedPhoto = document.querySelector('.example-photo.selected');
if (selectedPhoto) {
selectedPhoto.classList.remove('selected');
}
document.getElementById('example_photo').value = '';
}
</script>
</body>
</html>