Ashrafb commited on
Commit
87d4d03
·
verified ·
1 Parent(s): a347372

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +133 -73
static/index.html CHANGED
@@ -7,17 +7,49 @@
7
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.11/katex.min.css">
8
  <link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@100&display=swap" rel="stylesheet">
9
  <style>
10
- body {
11
- font-family: Arial, sans-serif;
12
- margin: 0;
13
- padding: 0;
14
- display: flex;
15
- justify-content: center;
16
- align-items: center;
17
- height: 100vh;
18
- background-color: black;
19
- }
20
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  .container {
22
  text-align: center;
23
  }
@@ -25,31 +57,22 @@
25
  h1 {
26
  margin-bottom: 20px;
27
  font-family: 'Barlow Condensed';
28
- color: #eeeeee;
29
- }
30
-
31
- input {
32
- padding: 10px;
33
- margin-right: 10px;
34
- border: none;
35
- border-radius: 8px;
36
- outline: none;
37
- }
38
-
39
- button {
40
- padding: 10px 20px;
41
- background-color: #007bff;
42
- color: #fff;
43
- border: none;
44
- cursor: pointer;
45
- border-radius: 8px;
46
- outline: none;
47
- }
48
-
49
- button:hover {
50
- background-color: #0056b3;
51
  }
 
 
 
 
 
 
 
 
 
 
 
52
 
 
 
53
  .image-container {
54
  display: flex;
55
  justify-content: center;
@@ -77,16 +100,48 @@
77
  object-fit: cover; /* Maintain aspect ratio and cover the entire box */
78
  }
79
 
80
- #prompt,
81
- #inputs,
82
  #noise_level {
83
- background-color: #ffffff;
 
 
 
 
 
 
 
 
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  </style>
86
  </head>
87
  <body>
88
  <div class="container">
89
- <h1>FastAPI App</h1>
 
90
  <div>
91
  <label for="prompt">Enter text:</label>
92
  <input type="text" id="prompt" name="prompt">
@@ -95,8 +150,10 @@
95
  <div>
96
  <button onclick="generatePrompts()">Generate Prompts</button>
97
  </div>
 
98
  <br>
99
- <div>
 
100
  <label for="inputs">Enter inputs:</label>
101
  <input type="text" id="inputs" name="inputs">
102
  <label for="noise_level">Noise Level:</label>
@@ -106,13 +163,21 @@
106
  <div>
107
  <button onclick="sendInputs()">Send Inputs</button>
108
  </div>
 
 
109
  <br>
 
 
110
  <div id="output-container" class="image-container">
111
- <!-- Empty image box -->
112
- <div id="image-box" class="image-box"></div>
 
 
 
113
  </div>
114
  </div>
115
-
 
116
  <script>
117
  function generatePrompts() {
118
  const prompt = document.getElementById("prompt").value;
@@ -127,37 +192,32 @@
127
  }
128
 
129
  function sendInputs() {
130
- const inputs = document.getElementById("inputs").value;
131
- const noiseLevel = document.getElementById("noise_level").value;
132
- const timestamp = new Date().getTime(); // Get current timestamp
133
- fetch(`/send_inputs?inputs=${encodeURIComponent(inputs)}&noise_level=${noiseLevel}&timestamp=${timestamp}`)
134
- .then(response => response.json())
135
- .then(data => {
136
- // Get the empty image box
137
- const imageBox = document.getElementById("image-box");
138
- // Remove any existing images
139
- imageBox.innerHTML = "";
140
- // Create a new image element
141
- const img = new Image();
142
- // Set the source of the image to the base64-encoded image data received from the server
143
- img.src = 'data:image/jpeg;base64,' + data.image_base64;
144
- // Resize the image
145
- const maxWidth = 200; // Set the maximum width for the image
146
- const maxHeight = 200; // Set the maximum height for the image
147
- if (img.width > maxWidth || img.height > maxHeight) {
148
- const ratio = Math.min(maxWidth / img.width, maxHeight / img.height);
149
- img.width *= ratio;
150
- img.height *= ratio;
151
- }
152
- // Append the image to the image box
153
- imageBox.appendChild(img);
154
- })
155
- .catch(error => {
156
- console.error('Error:', error);
157
- });
158
- }
159
-
160
-
161
  </script>
162
  </body>
163
  </html>
 
7
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.11/katex.min.css">
8
  <link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@100&display=swap" rel="stylesheet">
9
  <style>
10
+ html, body {
11
+ margin: 0;
12
+ padding: 0;
13
+ box-sizing: border-box;
14
+ overflow-x: hidden !important;
15
+ }
16
+ body {
17
+ background-color: #000000;
18
+ margin: 0;
19
+ }
20
+ #cont {
21
+ background-color: #030303;
22
+ padding: 0px;
23
+ border-radius: 12px;
24
+ box-shadow: 8px 8px 16px #050505, -8px -8px 16px #080808;
25
+ display: flex;
26
+ align-items: center;
27
+ border: 2px solid rgb(247, 6, 187);
28
+
29
+ }
30
+ #prompt {
31
+ flex-grow: 1;
32
+ padding: 10px;
33
+ margin: 10px;
34
+ background: transparent;
35
+ border: none;
36
+ border-radius: 8px;
37
+ box-shadow: linear-gradient(145deg, rgb(0, 249, 153), #ff002b);
38
+ color: #fff;
39
+ outline: none;
40
+ }
41
+ #cont button {
42
+ padding: 2.5vh 4.6vh;
43
+ margin: 1vh;
44
+ background: linear-gradient(145deg, rgb(0, 149, 249), #ff0095, rgb(255, 0, 43));
45
+ border: none;
46
+ border-radius: 8px;
47
+ color: #fff;
48
+ cursor: pointer;
49
+ }
50
+ #cont button:hover {
51
+ background: linear-gradient(145deg, #00ffab, #4e00f9, rgb(255, 0, 43));
52
+ }
53
  .container {
54
  text-align: center;
55
  }
 
57
  h1 {
58
  margin-bottom: 20px;
59
  font-family: 'Barlow Condensed';
60
+ color: pink;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
+ #inputs {
63
+ flex-grow: 1;
64
+ padding: 10px;
65
+ margin: 10px;
66
+ background: transparent;
67
+ border: none;
68
+ border-radius: 8px;
69
+ box-shadow: linear-gradient(145deg, rgb(0, 249, 153), #ff002b);
70
+ color: #fff;
71
+ outline: none;
72
+ }
73
 
74
+
75
+
76
  .image-container {
77
  display: flex;
78
  justify-content: center;
 
100
  object-fit: cover; /* Maintain aspect ratio and cover the entire box */
101
  }
102
 
103
+
104
+
105
  #noise_level {
106
+ flex-grow: 1;
107
+ padding: 10px;
108
+ margin: 10px;
109
+ background: transparent;
110
+ border: none;
111
+ border-radius: 8px;
112
+ box-shadow: linear-gradient(145deg, rgb(0, 249, 153), #ff002b);
113
+ color: #fff;
114
+ outline: none;
115
  }
116
+ #image-box {
117
+ border: 2px solid blue;
118
+ width: 330px;
119
+ height: 330px;
120
+ display: flex;
121
+ flex-direction: column;
122
+ overflow-y: scroll;
123
+ margin: auto;
124
+ margin-top: 30px;
125
+ padding-bottom: 7px;
126
+ gap: 14px;
127
+ background: linear-gradient(black, black) padding-box,
128
+ linear-gradient(to right, red, blue) border-box;
129
+ border-radius: 20px;
130
+ border: 2.5px solid transparent;
131
+ }
132
+
133
+ #image-box p {
134
+ width: 80%;
135
+ font-size: 20px;
136
+ color: white;
137
+ }
138
+
139
  </style>
140
  </head>
141
  <body>
142
  <div class="container">
143
+ <h1>Aiconvert.online </h1>
144
+ <div id="cont">
145
  <div>
146
  <label for="prompt">Enter text:</label>
147
  <input type="text" id="prompt" name="prompt">
 
150
  <div>
151
  <button onclick="generatePrompts()">Generate Prompts</button>
152
  </div>
153
+ </div>
154
  <br>
155
+ <div id="cont" >
156
+ <div>
157
  <label for="inputs">Enter inputs:</label>
158
  <input type="text" id="inputs" name="inputs">
159
  <label for="noise_level">Noise Level:</label>
 
163
  <div>
164
  <button onclick="sendInputs()">Send Inputs</button>
165
  </div>
166
+ </div>
167
+
168
  <br>
169
+
170
+
171
  <div id="output-container" class="image-container">
172
+
173
+
174
+ <div id="image-box" class="image-box">
175
+ <p>Your Generarted Arts Will appear Here</p>
176
+ </div>
177
  </div>
178
  </div>
179
+
180
+ </div>
181
  <script>
182
  function generatePrompts() {
183
  const prompt = document.getElementById("prompt").value;
 
192
  }
193
 
194
  function sendInputs() {
195
+ const inputs = document.getElementById("inputs").value;
196
+ const noiseLevel = document.getElementById("noise_level").value;
197
+ fetch(`/send_inputs?inputs=${encodeURIComponent(inputs)}&noise_level=${noiseLevel}`)
198
+ .then(response => response.json())
199
+ .then(data => {
200
+ // Get the empty image box
201
+ const imageBox = document.getElementById("image-box");
202
+ // Create a new image element
203
+ const img = new Image();
204
+ // Set the source of the image to the base64-encoded image data received from the server
205
+ img.src = 'data:image/jpeg;base64,' + data.image_base64;
206
+ // Resize the image
207
+ const maxWidth = 200; // Set the maximum width for the image
208
+ const maxHeight = 200; // Set the maximum height for the image
209
+ if (img.width > maxWidth || img.height > maxHeight) {
210
+ const ratio = Math.min(maxWidth / img.width, maxHeight / img.height);
211
+ img.width *= ratio;
212
+ img.height *= ratio;
213
+ }
214
+ // Append the image to the image box
215
+ imageBox.appendChild(img);
216
+ })
217
+ .catch(error => {
218
+ console.error('Error:', error);
219
+ });
220
+ }
 
 
 
 
 
221
  </script>
222
  </body>
223
  </html>