Spaces:
Running
Running
Update static/script.js
Browse files- static/script.js +35 -21
static/script.js
CHANGED
@@ -115,27 +115,41 @@ function loadResumerPage() {
|
|
115 |
return;
|
116 |
}
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
resultElement.innerText = "❌ Summary not available.";
|
140 |
}
|
141 |
} catch (error) {
|
|
|
115 |
return;
|
116 |
}
|
117 |
|
118 |
+
if (data.summary) {
|
119 |
+
resultElement.innerHTML = `
|
120 |
+
<div style="display: flex; align-items: center; justify-content: flex-end; margin-bottom: 10px;">
|
121 |
+
<button id="playVoiceBtn" style="
|
122 |
+
background: linear-gradient(125deg, rgba(163, 94, 237, 0.9) 0%, rgba(65, 159, 232, 0.9) 75%);
|
123 |
+
color: white;
|
124 |
+
border: none;
|
125 |
+
padding: 10px 16px;
|
126 |
+
border-radius: 12px;
|
127 |
+
cursor: pointer;
|
128 |
+
font-size: 14px;
|
129 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
130 |
+
transition: transform 0.2s;
|
131 |
+
">
|
132 |
+
🔊 Listen to Summary
|
133 |
+
</button>
|
134 |
+
</div>
|
135 |
+
<h3 class="centered-title">📝 Summary generated :</h3>
|
136 |
+
<br>
|
137 |
+
<p id="summaryText" style="font-size: 16px;">${data.summary}</p>
|
138 |
+
`;
|
139 |
+
|
140 |
+
document.getElementById("documentResult").dataset.summaryText = data.summary;
|
141 |
+
document.getElementById("downloadSection").style.display = "block";
|
142 |
+
|
143 |
+
// 🎤 Ajouter l'effet vocal
|
144 |
+
const playVoiceBtn = document.getElementById("playVoiceBtn");
|
145 |
+
playVoiceBtn.addEventListener("click", function () {
|
146 |
+
const textToRead = document.getElementById("summaryText").textContent;
|
147 |
+
const utterance = new SpeechSynthesisUtterance(textToRead);
|
148 |
+
utterance.lang = "en-US"; // ou "fr-FR" si ton résumé est en français
|
149 |
+
window.speechSynthesis.speak(utterance);
|
150 |
+
});
|
151 |
+
}
|
152 |
+
else {
|
153 |
resultElement.innerText = "❌ Summary not available.";
|
154 |
}
|
155 |
} catch (error) {
|