Spaces:
Sleeping
Sleeping
Create templates/index.html
Browse files- templates/index.html +88 -0
templates/index.html
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>Star Trek Image Generator</title>
|
7 |
+
<style>
|
8 |
+
body {
|
9 |
+
background: url('https://wallpapercave.com/wp/wp5766980.jpg') no-repeat center center fixed;
|
10 |
+
background-size: cover;
|
11 |
+
font-family: 'Arial', sans-serif;
|
12 |
+
color: #39ff14;
|
13 |
+
text-align: center;
|
14 |
+
padding-top: 100px;
|
15 |
+
}
|
16 |
+
h1 {
|
17 |
+
font-size: 48px;
|
18 |
+
text-shadow: 2px 2px 10px rgba(0, 255, 0, 0.8);
|
19 |
+
}
|
20 |
+
input {
|
21 |
+
width: 50%;
|
22 |
+
padding: 15px;
|
23 |
+
font-size: 18px;
|
24 |
+
border-radius: 5px;
|
25 |
+
border: 2px solid #39ff14;
|
26 |
+
background-color: black;
|
27 |
+
color: #39ff14;
|
28 |
+
}
|
29 |
+
button {
|
30 |
+
margin-top: 20px;
|
31 |
+
padding: 15px 30px;
|
32 |
+
font-size: 18px;
|
33 |
+
background-color: black;
|
34 |
+
color: #39ff14;
|
35 |
+
border: 2px solid #39ff14;
|
36 |
+
border-radius: 5px;
|
37 |
+
cursor: pointer;
|
38 |
+
}
|
39 |
+
button:hover {
|
40 |
+
background-color: #39ff14;
|
41 |
+
color: black;
|
42 |
+
}
|
43 |
+
#imageResult {
|
44 |
+
margin-top: 30px;
|
45 |
+
border: 3px solid #39ff14;
|
46 |
+
max-width: 80%;
|
47 |
+
box-shadow: 0px 0px 15px rgba(0, 255, 0, 0.8);
|
48 |
+
}
|
49 |
+
</style>
|
50 |
+
</head>
|
51 |
+
<body>
|
52 |
+
<h1>Star Trek AI Image Generator</h1>
|
53 |
+
<input type="text" id="promptInput" placeholder="Enter your image prompt...">
|
54 |
+
<br>
|
55 |
+
<button onclick="generateImage()">Generate</button>
|
56 |
+
<br>
|
57 |
+
<img id="imageResult" style="display:none;" />
|
58 |
+
|
59 |
+
<script>
|
60 |
+
function generateImage() {
|
61 |
+
var prompt = document.getElementById("promptInput").value;
|
62 |
+
if (!prompt) {
|
63 |
+
alert("Please enter a prompt!");
|
64 |
+
return;
|
65 |
+
}
|
66 |
+
|
67 |
+
fetch("/generate", {
|
68 |
+
method: "POST",
|
69 |
+
headers: {
|
70 |
+
"Content-Type": "application/json"
|
71 |
+
},
|
72 |
+
body: JSON.stringify({ prompt: prompt })
|
73 |
+
})
|
74 |
+
.then(response => response.json())
|
75 |
+
.then(data => {
|
76 |
+
if (data.image_url) {
|
77 |
+
var img = document.getElementById("imageResult");
|
78 |
+
img.src = data.image_url;
|
79 |
+
img.style.display = "block";
|
80 |
+
} else {
|
81 |
+
alert("Error generating image: " + data.error);
|
82 |
+
}
|
83 |
+
})
|
84 |
+
.catch(error => console.error("Error:", error));
|
85 |
+
}
|
86 |
+
</script>
|
87 |
+
</body>
|
88 |
+
</html>
|