Spaces:
Running
Running
Create index.html
Browse files- index.html +99 -0
index.html
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<title>Resumidor de Documentos</title>
|
| 5 |
+
<style>
|
| 6 |
+
body { font-family: Arial, sans-serif; text-align: center; margin-top: 50px; background-color: #f4f4f9; }
|
| 7 |
+
.container {
|
| 8 |
+
width: 80%;
|
| 9 |
+
max-width: 800px;
|
| 10 |
+
margin: 0 auto;
|
| 11 |
+
padding: 20px;
|
| 12 |
+
border: 1px solid #ccc;
|
| 13 |
+
border-radius: 10px;
|
| 14 |
+
background-color: #fff;
|
| 15 |
+
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
| 16 |
+
}
|
| 17 |
+
h1 { color: #333; }
|
| 18 |
+
p { color: #666; }
|
| 19 |
+
#file-upload { margin: 20px 0; }
|
| 20 |
+
button {
|
| 21 |
+
padding: 10px 20px;
|
| 22 |
+
background-color: #007bff;
|
| 23 |
+
color: white;
|
| 24 |
+
border: none;
|
| 25 |
+
border-radius: 5px;
|
| 26 |
+
cursor: pointer;
|
| 27 |
+
transition: background-color 0.3s;
|
| 28 |
+
}
|
| 29 |
+
button:hover {
|
| 30 |
+
background-color: #0056b3;
|
| 31 |
+
}
|
| 32 |
+
#summary-result {
|
| 33 |
+
margin-top: 20px;
|
| 34 |
+
text-align: left;
|
| 35 |
+
background-color: #e9ecef;
|
| 36 |
+
padding: 15px;
|
| 37 |
+
border-radius: 8px;
|
| 38 |
+
}
|
| 39 |
+
#loading {
|
| 40 |
+
color: #007bff;
|
| 41 |
+
font-size: 1.2em;
|
| 42 |
+
margin-top: 10px;
|
| 43 |
+
}
|
| 44 |
+
ul { list-style-type: disc; padding-left: 20px; }
|
| 45 |
+
li { margin-bottom: 10px; line-height: 1.5; }
|
| 46 |
+
</style>
|
| 47 |
+
</head>
|
| 48 |
+
<body>
|
| 49 |
+
<div class="container">
|
| 50 |
+
<h1>Resumidor de Documentos con IA</h1>
|
| 51 |
+
<p>Sube un archivo de texto (.txt) o PDF para generar un resumen de 5 puntos clave.</p>
|
| 52 |
+
<input type="file" id="file-upload" accept=".txt,.pdf">
|
| 53 |
+
<button onclick="uploadFile()">Generar Resumen</button>
|
| 54 |
+
<div id="loading" style="display: none;">Cargando...</div>
|
| 55 |
+
<div id="summary-result"></div>
|
| 56 |
+
</div>
|
| 57 |
+
<script>
|
| 58 |
+
async function uploadFile() {
|
| 59 |
+
const fileInput = document.getElementById('file-upload');
|
| 60 |
+
const file = fileInput.files[0];
|
| 61 |
+
if (!file) {
|
| 62 |
+
alert('Por favor, selecciona un archivo.');
|
| 63 |
+
return;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
const formData = new FormData();
|
| 67 |
+
formData.append('file', file);
|
| 68 |
+
|
| 69 |
+
document.getElementById('loading').style.display = 'block';
|
| 70 |
+
document.getElementById('summary-result').innerHTML = '';
|
| 71 |
+
|
| 72 |
+
try {
|
| 73 |
+
const response = await fetch('/summarize', {
|
| 74 |
+
method: 'POST',
|
| 75 |
+
body: formData
|
| 76 |
+
});
|
| 77 |
+
const data = await response.json();
|
| 78 |
+
|
| 79 |
+
if (response.ok) {
|
| 80 |
+
const resultDiv = document.getElementById('summary-result');
|
| 81 |
+
const ul = document.createElement('ul');
|
| 82 |
+
data.summary.forEach(point => {
|
| 83 |
+
const li = document.createElement('li');
|
| 84 |
+
li.textContent = point;
|
| 85 |
+
ul.appendChild(li);
|
| 86 |
+
});
|
| 87 |
+
resultDiv.appendChild(ul);
|
| 88 |
+
} else {
|
| 89 |
+
alert('Error: ' + data.error);
|
| 90 |
+
}
|
| 91 |
+
} catch (error) {
|
| 92 |
+
alert('Ocurri贸 un error al conectar con el servidor.');
|
| 93 |
+
} finally {
|
| 94 |
+
document.getElementById('loading').style.display = 'none';
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
</script>
|
| 98 |
+
</body>
|
| 99 |
+
</html>
|