Advay-Singh commited on
Commit
f967b28
·
verified ·
1 Parent(s): 0b7cbed

Update templates/imagine.html

Browse files
Files changed (1) hide show
  1. templates/imagine.html +36 -2
templates/imagine.html CHANGED
@@ -67,6 +67,36 @@
67
  h1 {
68
  text-align: center;
69
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  </style>
71
 
72
  <div>
@@ -78,11 +108,14 @@
78
  </div>
79
  <div id="inputWrapper">
80
  <input type="text" id="contents" placeholder="Enter your prompt..."><br><br><br>
81
- <button onclick="generate()">Generate Image</button>
82
  </div>
83
  </body>
84
  <script>
85
  async function generate() {
 
 
 
86
  const contents = document.getElementById("contents").value;
87
  const response = await fetch("/imagine", {
88
  method: "POST",
@@ -96,8 +129,9 @@
96
  const blob = await response.blob();
97
  const imgUrl = URL.createObjectURL(blob);
98
  document.getElementById("generated_image").src = imgUrl;
99
- document.getElementById("contents").value = "";
100
  document.getElementById("image").style.border = "none";
 
101
  } else {
102
  console.error("Error generating image:", response.statusText);
103
  }
 
67
  h1 {
68
  text-align: center;
69
  }
70
+
71
+ @keyframes color-change {
72
+ 0% {
73
+ background-color: red;
74
+ }
75
+
76
+ 20% {
77
+ background-color: blue;
78
+ }
79
+
80
+ 40% {
81
+ background-color: rgb(0, 255, 0);
82
+ }
83
+
84
+ 60% {
85
+ background-color: aqua;
86
+ }
87
+
88
+ 80% {
89
+ background-color: yellow;
90
+ }
91
+
92
+ 100% {
93
+ background-color: red;
94
+ }
95
+ }
96
+
97
+ .color_change {
98
+ animation: color-change 4s infinite;
99
+ }
100
  </style>
101
 
102
  <div>
 
108
  </div>
109
  <div id="inputWrapper">
110
  <input type="text" id="contents" placeholder="Enter your prompt..."><br><br><br>
111
+ <button onclick="generate()" id="generate_button">Generate Image</button>
112
  </div>
113
  </body>
114
  <script>
115
  async function generate() {
116
+ document.getElementById("generate_button").disabled = true
117
+ document.getElementById("image").classList.add("color_change");
118
+ document.getElementById("image").src = "";
119
  const contents = document.getElementById("contents").value;
120
  const response = await fetch("/imagine", {
121
  method: "POST",
 
129
  const blob = await response.blob();
130
  const imgUrl = URL.createObjectURL(blob);
131
  document.getElementById("generated_image").src = imgUrl;
132
+ document.getElementById("image").classList.remove("color_change")
133
  document.getElementById("image").style.border = "none";
134
+ document.getElementById("generate_button").disabled = false
135
  } else {
136
  console.error("Error generating image:", response.statusText);
137
  }