Spaces:
Running
Running
final
Browse files- static/script.js +5 -7
static/script.js
CHANGED
|
@@ -674,8 +674,7 @@ fileInput.addEventListener('change', function(event) {
|
|
| 674 |
uploadIcon.style.display = "none";
|
| 675 |
}
|
| 676 |
});
|
| 677 |
-
|
| 678 |
-
// 👉 Fonction d'envoi de la question/document
|
| 679 |
const askBtn = document.getElementById('askDocBtn');
|
| 680 |
askBtn.addEventListener('click', async () => {
|
| 681 |
const file = fileInput.files[0];
|
|
@@ -691,7 +690,7 @@ askBtn.addEventListener('click', async () => {
|
|
| 691 |
formData.append("file", file);
|
| 692 |
formData.append("question", question);
|
| 693 |
|
| 694 |
-
|
| 695 |
answerDiv.innerHTML = "⏳Document analysis in progress...";
|
| 696 |
|
| 697 |
try {
|
|
@@ -720,10 +719,10 @@ askBtn.addEventListener('click', async () => {
|
|
| 720 |
</div>
|
| 721 |
<h3 class="centered-title">✅ The result :</h3>
|
| 722 |
<br>
|
| 723 |
-
<p id="answerText"
|
| 724 |
`;
|
| 725 |
|
| 726 |
-
|
| 727 |
const playVoiceBtn = document.getElementById("playAnswerVoiceBtn");
|
| 728 |
playVoiceBtn.addEventListener("click", function () {
|
| 729 |
const textToRead = document.getElementById("answerText").textContent;
|
|
@@ -745,10 +744,9 @@ askBtn.addEventListener('click', async () => {
|
|
| 745 |
|
| 746 |
//quand on clique sur visualisation ----------------------
|
| 747 |
function loadVisualisationPage() {
|
| 748 |
-
|
| 749 |
document.body.style.setProperty('--background-image', "url('visualisation.webp')");
|
| 750 |
|
| 751 |
-
// 2. Création de la structure HTML
|
| 752 |
const appContainer = document.createElement("div");
|
| 753 |
appContainer.className = "app-container";
|
| 754 |
appContainer.innerHTML = `
|
|
|
|
| 674 |
uploadIcon.style.display = "none";
|
| 675 |
}
|
| 676 |
});
|
| 677 |
+
|
|
|
|
| 678 |
const askBtn = document.getElementById('askDocBtn');
|
| 679 |
askBtn.addEventListener('click', async () => {
|
| 680 |
const file = fileInput.files[0];
|
|
|
|
| 690 |
formData.append("file", file);
|
| 691 |
formData.append("question", question);
|
| 692 |
|
| 693 |
+
|
| 694 |
answerDiv.innerHTML = "⏳Document analysis in progress...";
|
| 695 |
|
| 696 |
try {
|
|
|
|
| 719 |
</div>
|
| 720 |
<h3 class="centered-title">✅ The result :</h3>
|
| 721 |
<br>
|
| 722 |
+
<p id="answerText">${data.answer}</p>
|
| 723 |
`;
|
| 724 |
|
| 725 |
+
|
| 726 |
const playVoiceBtn = document.getElementById("playAnswerVoiceBtn");
|
| 727 |
playVoiceBtn.addEventListener("click", function () {
|
| 728 |
const textToRead = document.getElementById("answerText").textContent;
|
|
|
|
| 744 |
|
| 745 |
//quand on clique sur visualisation ----------------------
|
| 746 |
function loadVisualisationPage() {
|
| 747 |
+
|
| 748 |
document.body.style.setProperty('--background-image', "url('visualisation.webp')");
|
| 749 |
|
|
|
|
| 750 |
const appContainer = document.createElement("div");
|
| 751 |
appContainer.className = "app-container";
|
| 752 |
appContainer.innerHTML = `
|