Spaces:
Runtime error
Runtime error
Update static/index.html
Browse files- static/index.html +107 -301
static/index.html
CHANGED
|
@@ -3,335 +3,141 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<
|
| 7 |
-
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
|
| 8 |
-
<title>Vion AI</title>
|
| 9 |
<style>
|
| 10 |
-
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;800&display=swap');
|
| 11 |
-
|
| 12 |
-
* {
|
| 13 |
-
margin: 0;
|
| 14 |
-
padding: 0;
|
| 15 |
-
outline: none;
|
| 16 |
-
box-sizing: border-box;
|
| 17 |
-
font-family: "Open Sans", sans-serif;
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
:root {
|
| 21 |
-
--primary-color: #0A0A0B;
|
| 22 |
-
--secondary-color: #1A1B1E;
|
| 23 |
-
--secondary-hover-color: #2A2B2E;
|
| 24 |
-
--focus-color: #242528;
|
| 25 |
-
--focus-hover-color: #343538;
|
| 26 |
-
--button-hover-color: #252627;
|
| 27 |
-
--text-color: #FFFFFF;
|
| 28 |
-
--text-secondary-color: #A0A1A3;
|
| 29 |
-
--heading-secondary-color: #606162;
|
| 30 |
-
--placeholder-color: #78797A;
|
| 31 |
-
--accent-color: #00A3FF;
|
| 32 |
-
--star-color: #FFFFFF;
|
| 33 |
-
--background-color: #000;
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
.light_mode {
|
| 37 |
-
--primary-color: #FFFFFF;
|
| 38 |
-
--secondary-color: #F5F6F5;
|
| 39 |
-
--secondary-hover-color: #E5E6E5;
|
| 40 |
-
--focus-color: #ECEDEC;
|
| 41 |
-
--focus-hover-color: #E0E1E0;
|
| 42 |
-
--button-hover-color: #ECEDED;
|
| 43 |
-
--text-color: #0A0A0B;
|
| 44 |
-
--text-secondary-color: #4A4B4C;
|
| 45 |
-
--heading-secondary-color: #BABBBB;
|
| 46 |
-
--placeholder-color: #868788;
|
| 47 |
-
--accent-color: #007ACC;
|
| 48 |
-
--star-color: #666;
|
| 49 |
-
--background-color: #E0E7FF;
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
body {
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
position: relative;
|
| 59 |
-
overflow-y: auto;
|
| 60 |
-
}
|
| 61 |
-
|
| 62 |
-
.stars {
|
| 63 |
-
position: fixed;
|
| 64 |
-
width: 100%;
|
| 65 |
-
height: 100%;
|
| 66 |
-
background: url('https://www.transparenttextures.com/patterns/stardust.png');
|
| 67 |
-
animation: starsAnim 100s linear infinite;
|
| 68 |
-
z-index: -1;
|
| 69 |
-
}
|
| 70 |
-
|
| 71 |
-
.light_mode .stars {
|
| 72 |
-
background: url('https://www.transparenttextures.com/patterns/stardust.png') rgba(224, 231, 255, 0.8);
|
| 73 |
-
opacity: 0.3;
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
@keyframes starsAnim {
|
| 77 |
-
from { background-position: 0 0; }
|
| 78 |
-
to { background-position: 10000px 10000px; }
|
| 79 |
-
}
|
| 80 |
-
|
| 81 |
-
.main-content {
|
| 82 |
-
flex: 1;
|
| 83 |
-
display: flex;
|
| 84 |
-
flex-direction: column;
|
| 85 |
-
justify-content: center;
|
| 86 |
-
padding-bottom: 80px;
|
| 87 |
-
padding-top: 2rem;
|
| 88 |
}
|
| 89 |
-
|
| 90 |
-
.header {
|
| 91 |
-
max-width: 900px;
|
| 92 |
text-align: center;
|
| 93 |
-
|
| 94 |
-
margin: 0 auto;
|
| 95 |
}
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
font-weight: 800;
|
| 101 |
-
margin-bottom: 1rem;
|
| 102 |
-
text-shadow: 0 0 10px rgba(0, 163, 255, 0.5);
|
| 103 |
}
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
margin: 0 auto;
|
| 111 |
-
text-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
| 112 |
-
}
|
| 113 |
-
|
| 114 |
-
.suggests {
|
| 115 |
-
display: grid;
|
| 116 |
-
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 117 |
-
margin: 2rem auto;
|
| 118 |
-
max-width: 900px;
|
| 119 |
-
gap: 1rem;
|
| 120 |
-
padding: 0 2rem;
|
| 121 |
}
|
| 122 |
-
|
| 123 |
-
.suggests__item {
|
| 124 |
-
background: rgba(26, 27, 30, 0.9);
|
| 125 |
-
color: var(--text-secondary-color);
|
| 126 |
-
padding: 1.5rem;
|
| 127 |
-
border-radius: 0.5rem;
|
| 128 |
-
cursor: pointer;
|
| 129 |
-
transition: all 0.3s ease;
|
| 130 |
-
border: 1px solid var(--focus-color);
|
| 131 |
-
}
|
| 132 |
-
|
| 133 |
-
.light_mode .suggests__item {
|
| 134 |
-
background: rgba(245, 246, 245, 0.9);
|
| 135 |
-
}
|
| 136 |
-
|
| 137 |
-
.suggests__item:hover {
|
| 138 |
-
background: var(--secondary-hover-color);
|
| 139 |
-
border-color: var(--accent-color);
|
| 140 |
-
color: var(--text-color);
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
-
.suggests__item-icon {
|
| 144 |
-
margin-top: 1rem;
|
| 145 |
-
color: var(--accent-color);
|
| 146 |
-
}
|
| 147 |
-
|
| 148 |
-
.prompt {
|
| 149 |
-
position: fixed;
|
| 150 |
-
background: rgba(10, 10, 11, 0.9);
|
| 151 |
-
z-index: 1000;
|
| 152 |
width: 100%;
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
border-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
background:
|
| 161 |
-
|
| 162 |
-
}
|
| 163 |
-
|
| 164 |
-
.prompt__input-wrapper {
|
| 165 |
-
max-width: 900px;
|
| 166 |
-
margin: 0 auto;
|
| 167 |
-
position: relative;
|
| 168 |
-
display: flex;
|
| 169 |
-
align-items: center;
|
| 170 |
-
background: var(--secondary-color);
|
| 171 |
-
border: 1px solid var(--focus-color);
|
| 172 |
-
border-radius: 0.5rem;
|
| 173 |
-
padding: 0.2rem;
|
| 174 |
-
transition: all 0.3s ease;
|
| 175 |
-
}
|
| 176 |
-
|
| 177 |
-
.prompt__input-wrapper:focus-within {
|
| 178 |
-
border-color: var(--accent-color);
|
| 179 |
-
background: var(--focus-color);
|
| 180 |
-
}
|
| 181 |
-
|
| 182 |
-
.prompt__form-input {
|
| 183 |
-
flex-grow: 1;
|
| 184 |
border: none;
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
color: var(--text-color);
|
| 188 |
-
padding: 0.3rem 0.5rem;
|
| 189 |
-
background: transparent;
|
| 190 |
-
outline: none;
|
| 191 |
-
}
|
| 192 |
-
|
| 193 |
-
.prompt__form-input::placeholder {
|
| 194 |
-
color: var(--placeholder-color);
|
| 195 |
-
}
|
| 196 |
-
|
| 197 |
-
.prompt__action-buttons {
|
| 198 |
-
display: flex;
|
| 199 |
-
align-items: center;
|
| 200 |
-
gap: 0.3rem;
|
| 201 |
-
padding-right: 0.3rem;
|
| 202 |
-
}
|
| 203 |
-
|
| 204 |
-
.prompt__form-button {
|
| 205 |
-
background: none;
|
| 206 |
-
border: none;
|
| 207 |
-
color: var(--text-secondary-color);
|
| 208 |
-
font-size: 1.1rem;
|
| 209 |
cursor: pointer;
|
| 210 |
-
|
| 211 |
-
transition: color 0.3s ease;
|
| 212 |
}
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
color: var(--accent-color);
|
| 216 |
}
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
max-width: 900px;
|
| 224 |
-
margin-left: auto;
|
| 225 |
-
margin-right: auto;
|
| 226 |
-
text-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
| 227 |
}
|
| 228 |
</style>
|
| 229 |
</head>
|
| 230 |
<body>
|
| 231 |
-
<
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 273 |
|
| 274 |
<script>
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
document.
|
| 279 |
-
themeToggler.innerHTML = document.body.classList.contains('light_mode') ? "<i class='bx bx-moon'></i>" : "<i class='bx bx-sun'></i>";
|
| 280 |
-
});
|
| 281 |
-
|
| 282 |
-
// Send prompt to backend
|
| 283 |
-
const promptForm = document.getElementById('promptForm');
|
| 284 |
-
const promptInput = document.getElementById('promptInput');
|
| 285 |
|
| 286 |
-
|
| 287 |
-
e.preventDefault();
|
| 288 |
-
const prompt = promptInput.value.trim();
|
| 289 |
-
if (!prompt) return;
|
| 290 |
|
| 291 |
try {
|
| 292 |
-
const response = await fetch(
|
| 293 |
-
method: 'POST',
|
| 294 |
-
headers: { 'Content-Type': 'application/json' },
|
| 295 |
-
body: JSON.stringify({ text: prompt })
|
| 296 |
-
});
|
| 297 |
-
|
| 298 |
-
if (!response.ok) throw new Error('Failed to fetch response');
|
| 299 |
-
const data = await response.json();
|
| 300 |
-
alert(`Response: ${data.summary}`);
|
| 301 |
-
} catch (error) {
|
| 302 |
-
console.error('Error:', error);
|
| 303 |
-
alert('Failed to get a response. Please try again.');
|
| 304 |
-
}
|
| 305 |
-
});
|
| 306 |
-
|
| 307 |
-
// Send predefined prompt
|
| 308 |
-
function sendPrompt(prompt, endpoint) {
|
| 309 |
-
promptInput.value = prompt;
|
| 310 |
-
promptForm.dispatchEvent(new Event('submit'));
|
| 311 |
-
}
|
| 312 |
-
|
| 313 |
-
// File upload
|
| 314 |
-
document.getElementById('fileInput').addEventListener('change', async (e) => {
|
| 315 |
-
const file = e.target.files[0];
|
| 316 |
-
if (!file) return;
|
| 317 |
-
|
| 318 |
-
const formData = new FormData();
|
| 319 |
-
formData.append('file', file);
|
| 320 |
-
|
| 321 |
-
try {
|
| 322 |
-
const response = await fetch('/summarize', {
|
| 323 |
method: 'POST',
|
| 324 |
body: formData
|
| 325 |
});
|
| 326 |
|
| 327 |
-
if (!response.ok)
|
|
|
|
|
|
|
|
|
|
| 328 |
const data = await response.json();
|
| 329 |
-
|
| 330 |
} catch (error) {
|
| 331 |
-
|
| 332 |
-
alert('Failed to process file. Please try again.');
|
| 333 |
}
|
| 334 |
-
}
|
| 335 |
</script>
|
| 336 |
</body>
|
| 337 |
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>AI Web Application</title>
|
|
|
|
|
|
|
| 7 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
body {
|
| 9 |
+
font-family: Arial, sans-serif;
|
| 10 |
+
margin: 20px;
|
| 11 |
+
padding: 0;
|
| 12 |
+
background-color: #f4f4f9;
|
| 13 |
+
color: #333;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
}
|
| 15 |
+
h1 {
|
|
|
|
|
|
|
| 16 |
text-align: center;
|
| 17 |
+
color: #444;
|
|
|
|
| 18 |
}
|
| 19 |
+
h2 {
|
| 20 |
+
color: #555;
|
| 21 |
+
border-bottom: 2px solid #ddd;
|
| 22 |
+
padding-bottom: 5px;
|
|
|
|
|
|
|
|
|
|
| 23 |
}
|
| 24 |
+
form {
|
| 25 |
+
background: #fff;
|
| 26 |
+
padding: 20px;
|
| 27 |
+
border-radius: 8px;
|
| 28 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
| 29 |
+
margin-bottom: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
}
|
| 31 |
+
input[type="file"], textarea, input[type="text"] {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
width: 100%;
|
| 33 |
+
padding: 10px;
|
| 34 |
+
margin: 10px 0;
|
| 35 |
+
border: 1px solid #ddd;
|
| 36 |
+
border-radius: 4px;
|
| 37 |
+
font-size: 16px;
|
| 38 |
+
}
|
| 39 |
+
button {
|
| 40 |
+
background-color: #007bff;
|
| 41 |
+
color: white;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
border: none;
|
| 43 |
+
padding: 10px 20px;
|
| 44 |
+
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
cursor: pointer;
|
| 46 |
+
font-size: 16px;
|
|
|
|
| 47 |
}
|
| 48 |
+
button:hover {
|
| 49 |
+
background-color: #0056b3;
|
|
|
|
| 50 |
}
|
| 51 |
+
.result {
|
| 52 |
+
background: #e9ecef;
|
| 53 |
+
padding: 15px;
|
| 54 |
+
border-radius: 4px;
|
| 55 |
+
margin-top: 10px;
|
| 56 |
+
font-family: monospace;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
}
|
| 58 |
</style>
|
| 59 |
</head>
|
| 60 |
<body>
|
| 61 |
+
<h1>AI Web Application</h1>
|
| 62 |
+
|
| 63 |
+
<!-- Summarization -->
|
| 64 |
+
<h2>Summarization</h2>
|
| 65 |
+
<form id="summarizeForm">
|
| 66 |
+
<input type="file" name="file" accept=".pdf,.docx">
|
| 67 |
+
<textarea name="text" placeholder="Or enter text manually"></textarea>
|
| 68 |
+
<button type="button" onclick="submitForm('/summarize', 'summarizeForm', 'summarizeResult')">Summarize</button>
|
| 69 |
+
</form>
|
| 70 |
+
<div id="summarizeResult" class="result"></div>
|
| 71 |
+
|
| 72 |
+
<!-- Image Captioning -->
|
| 73 |
+
<h2>Image Captioning</h2>
|
| 74 |
+
<form id="captionForm">
|
| 75 |
+
<input type="file" name="file" accept="image/*">
|
| 76 |
+
<button type="button" onclick="submitForm('/caption', 'captionForm', 'captionResult')">Generate Caption</button>
|
| 77 |
+
</form>
|
| 78 |
+
<div id="captionResult" class="result"></div>
|
| 79 |
+
|
| 80 |
+
<!-- Question Answering -->
|
| 81 |
+
<h2>Question Answering</h2>
|
| 82 |
+
<form id="answerForm">
|
| 83 |
+
<input type="file" name="file" accept=".pdf,.docx">
|
| 84 |
+
<textarea name="text" placeholder="Or enter text manually"></textarea>
|
| 85 |
+
<input type="text" name="question" placeholder="Enter your question">
|
| 86 |
+
<button type="button" onclick="submitForm('/answer', 'answerForm', 'answerResult')">Answer</button>
|
| 87 |
+
</form>
|
| 88 |
+
<div id="answerResult" class="result"></div>
|
| 89 |
+
|
| 90 |
+
<!-- Visual Question Answering -->
|
| 91 |
+
<h2>Visual Question Answering</h2>
|
| 92 |
+
<form id="vqaForm">
|
| 93 |
+
<input type="file" name="file" accept="image/*">
|
| 94 |
+
<input type="text" name="question" placeholder="Enter your question">
|
| 95 |
+
<button type="button" onclick="submitForm('/vqa', 'vqaForm', 'vqaResult')">Answer</button>
|
| 96 |
+
</form>
|
| 97 |
+
<div id="vqaResult" class="result"></div>
|
| 98 |
+
|
| 99 |
+
<!-- Data Visualization -->
|
| 100 |
+
<h2>Data Visualization</h2>
|
| 101 |
+
<form id="visualizeForm">
|
| 102 |
+
<input type="file" name="file" accept=".xlsx,.xls">
|
| 103 |
+
<input type="text" name="request" placeholder="Enter visualization request (e.g., bar, line)">
|
| 104 |
+
<button type="button" onclick="submitForm('/visualize', 'visualizeForm', 'visualizeResult')">Generate Code</button>
|
| 105 |
+
</form>
|
| 106 |
+
<div id="visualizeResult" class="result"></div>
|
| 107 |
+
|
| 108 |
+
<!-- Document Translation -->
|
| 109 |
+
<h2>Document Translation</h2>
|
| 110 |
+
<form id="translateForm">
|
| 111 |
+
<input type="file" name="file" accept=".pdf,.docx">
|
| 112 |
+
<input type="text" name="target_language" placeholder="Enter target language (e.g., fr, es)">
|
| 113 |
+
<button type="button" onclick="submitForm('/translate', 'translateForm', 'translateResult')">Translate</button>
|
| 114 |
+
</form>
|
| 115 |
+
<div id="translateResult" class="result"></div>
|
| 116 |
|
| 117 |
<script>
|
| 118 |
+
async function submitForm(endpoint, formId, resultId) {
|
| 119 |
+
const form = document.getElementById(formId);
|
| 120 |
+
const formData = new FormData(form);
|
| 121 |
+
const resultDiv = document.getElementById(resultId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
|
| 123 |
+
resultDiv.innerHTML = "Processing...";
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
try {
|
| 126 |
+
const response = await fetch(endpoint, {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 127 |
method: 'POST',
|
| 128 |
body: formData
|
| 129 |
});
|
| 130 |
|
| 131 |
+
if (!response.ok) {
|
| 132 |
+
throw new Error(`HTTP error! Status: ${response.status}`);
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
const data = await response.json();
|
| 136 |
+
resultDiv.innerHTML = `<pre>${JSON.stringify(data, null, 2)}</pre>`;
|
| 137 |
} catch (error) {
|
| 138 |
+
resultDiv.innerHTML = `Error: ${error.message}`;
|
|
|
|
| 139 |
}
|
| 140 |
+
}
|
| 141 |
</script>
|
| 142 |
</body>
|
| 143 |
</html>
|