Spaces:
Running
Running
Update test2.html
Browse files- test2.html +12 -13
test2.html
CHANGED
|
@@ -4,9 +4,12 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Modelo de Preguntas y Respuestas sobre un PDF</title>
|
| 7 |
-
<script
|
| 8 |
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
| 10 |
</head>
|
| 11 |
<body>
|
| 12 |
<h1>Modelo de Preguntas y Respuestas sobre un PDF</h1>
|
|
@@ -77,17 +80,13 @@
|
|
| 77 |
|
| 78 |
// Funci贸n para obtener respuesta utilizando el modelo de Hugging Face
|
| 79 |
async function obtenerRespuestaDeModelo(question, context) {
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
const
|
| 84 |
-
|
| 85 |
-
const answer_start = output.start_logits.argmax();
|
| 86 |
-
const answer_end = output.end_logits.argmax();
|
| 87 |
-
const answer = tokenizer.decode(inputs.input_ids.slice(answer_start, answer_end + 1));
|
| 88 |
-
|
| 89 |
-
return answer;
|
| 90 |
}
|
| 91 |
</script>
|
| 92 |
</body>
|
| 93 |
</html>
|
|
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Modelo de Preguntas y Respuestas sobre un PDF</title>
|
| 7 |
+
<script type="module">
|
| 8 |
+
// Aseguramos que pdf.js est茅 cargado antes de configurarlo
|
| 9 |
+
import pdfjsLib from 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.min.js';
|
| 10 |
+
|
| 11 |
+
pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.worker.min.js';
|
| 12 |
+
</script>
|
| 13 |
</head>
|
| 14 |
<body>
|
| 15 |
<h1>Modelo de Preguntas y Respuestas sobre un PDF</h1>
|
|
|
|
| 80 |
|
| 81 |
// Funci贸n para obtener respuesta utilizando el modelo de Hugging Face
|
| 82 |
async function obtenerRespuestaDeModelo(question, context) {
|
| 83 |
+
// En este ejemplo, aqu铆 puedes integrar una API de preguntas y respuestas
|
| 84 |
+
// como Hugging Face o TensorFlow.js con BERT.
|
| 85 |
+
// En esta versi贸n solo devolveremos una frase que coincida con el contexto.
|
| 86 |
+
const fraseRespuesta = "Aqu铆 ir铆a la respuesta generada por el modelo (por ejemplo, usando BERT o T5)";
|
| 87 |
+
return fraseRespuesta;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
}
|
| 89 |
</script>
|
| 90 |
</body>
|
| 91 |
</html>
|
| 92 |
+
|