Subbu1304 commited on
Commit
16728af
·
verified ·
1 Parent(s): a3cbcf6

Create templets/index.html

Browse files
Files changed (1) hide show
  1. templets/index.html +46 -0
templets/index.html ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Food Image Generator</title>
7
+ <style>
8
+ #generated-image {
9
+ margin-top: 20px;
10
+ max-width: 100%;
11
+ height: auto;
12
+ }
13
+ </style>
14
+ </head>
15
+ <body>
16
+ <h1>AI Food Image Generator</h1>
17
+ <textarea id="food-description" placeholder="Describe the food (e.g., Spicy Paneer Tikka with grilled vegetables)" rows="4" cols="50"></textarea><br>
18
+ <button onclick="generateImage()">Generate Image</button>
19
+
20
+ <div id="result">
21
+ <img id="generated-image" src="" alt="Generated food image will appear here" />
22
+ </div>
23
+
24
+ <script>
25
+ async function generateImage() {
26
+ const description = document.getElementById("food-description").value;
27
+ if (!description) {
28
+ alert("Please enter a food description!");
29
+ return;
30
+ }
31
+
32
+ const response = await fetch('http://127.0.0.1:5000/generate-image', {
33
+ method: 'POST',
34
+ headers: {
35
+ 'Content-Type': 'application/json'
36
+ },
37
+ body: JSON.stringify({ description })
38
+ });
39
+
40
+ const data = await response.json();
41
+ const imageUrl = data.image_url;
42
+ document.getElementById("generated-image").src = imageUrl;
43
+ }
44
+ </script>
45
+ </body>
46
+ </html>