Update templates/message.html
Browse files- templates/message.html +16 -11
templates/message.html
CHANGED
@@ -2,21 +2,26 @@
|
|
2 |
{% block content %}
|
3 |
<h1>Happy Birthday, Manavi!</h1>
|
4 |
<p>Little Krishna has a special message for you!</p>
|
5 |
-
<img id="birthday-image" src="" alt="Krishna Birthday Wish"
|
6 |
-
<lottie-player src="/static/assets/krishna-lottie.json" background="transparent" speed="1" style="width: 300px; height: 300px;" loop autoplay></lottie-player>
|
7 |
<p id="birthday-message">Hare Manavi! On April 19, 2025, I’ve come from Vrindavan to wish you a joyous birthday! Ayush says: ‘You’re my sweetest friend, more precious than butter!’</p>
|
8 |
<script>
|
9 |
document.addEventListener('DOMContentLoaded', async () => {
|
10 |
const birthdayImage = document.getElementById('birthday-image');
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
20 |
birthdayImage.src = 'https://via.placeholder.com/300x300.png?text=Error+Loading+Image';
|
21 |
}
|
22 |
});
|
|
|
2 |
{% block content %}
|
3 |
<h1>Happy Birthday, Manavi!</h1>
|
4 |
<p>Little Krishna has a special message for you!</p>
|
5 |
+
<img id="birthday-image" src="" alt="Krishna Birthday Wish">
|
6 |
+
<lottie-player src="/static/assets/krishna-lottie.json" background="transparent" speed="1" style="width: 300px; height: 300px; margin: 0 auto;" loop autoplay></lottie-player>
|
7 |
<p id="birthday-message">Hare Manavi! On April 19, 2025, I’ve come from Vrindavan to wish you a joyous birthday! Ayush says: ‘You’re my sweetest friend, more precious than butter!’</p>
|
8 |
<script>
|
9 |
document.addEventListener('DOMContentLoaded', async () => {
|
10 |
const birthdayImage = document.getElementById('birthday-image');
|
11 |
+
try {
|
12 |
+
const response = await fetch('/image', {
|
13 |
+
method: 'POST',
|
14 |
+
headers: { 'Content-Type': 'application/json' },
|
15 |
+
body: JSON.stringify({ prompt: 'Little Krishna playing flute and wishing happy birthday, cartoon style' })
|
16 |
+
});
|
17 |
+
const data = await response.json();
|
18 |
+
if (data.image_url) {
|
19 |
+
birthdayImage.src = data.image_url;
|
20 |
+
} else {
|
21 |
+
birthdayImage.src = 'https://via.placeholder.com/300x300.png?text=Error+Loading+Image';
|
22 |
+
}
|
23 |
+
} catch (error) {
|
24 |
+
console.error('Error fetching birthday image:', error);
|
25 |
birthdayImage.src = 'https://via.placeholder.com/300x300.png?text=Error+Loading+Image';
|
26 |
}
|
27 |
});
|