Spaces:
Build error
Build error
| const inputDiv = document.getElementById("input"); | |
| const output1Div = document.getElementById("output1"); | |
| const output2Div = document.getElementById("output2"); | |
| // Clear input and outputs | |
| function clearInput() { | |
| inputDiv.innerHTML = ""; | |
| output1Div.innerHTML = ""; | |
| output2Div.innerHTML = ""; | |
| } | |
| // Copy input text | |
| function copyInputText() { | |
| const text = inputDiv.textContent.trim(); | |
| if (!text) return alert("αα·αααΆαα’ααααααααααΆααα ααααααα"); | |
| navigator.clipboard.writeText(text).then(() => alert("α’αααααααααΌαααΆαα αααα!")); | |
| } | |
| // Copy output text | |
| function copyOutput(outputId) { | |
| const outputDiv = document.getElementById(outputId); | |
| const text = outputDiv.textContent.trim(); | |
| if (!text) return alert("αα·αααΆααααααααααααΆααα ααααααα"); | |
| navigator.clipboard.writeText(text).then(() => alert("ααααααααααΌαααΆαα αααα!")); | |
| } | |
| // Summarize button | |
| async function summarizeText() { | |
| const text = inputDiv.textContent.trim(); | |
| if (!text) return alert("ααΌααααα αΌαα’αααααααααααα"); | |
| const model1 = document.getElementById("model-select-1").value; | |
| const model2 = document.getElementById("model-select-2").value; | |
| output1Div.innerHTML = "αααα»ααααααα..."; | |
| output2Div.innerHTML = "αααα»ααααααα..."; | |
| try { | |
| const response = await fetch("/summarize", { | |
| method: "POST", | |
| headers: { "Content-Type": "application/json" }, | |
| body: JSON.stringify({ text: text, models: [model1, model2] }), | |
| }); | |
| const data = await response.json(); | |
| if (data.results) { | |
| output1Div.innerText = data.results[model1]?.summary || "ααααΆααααααα"; | |
| output2Div.innerText = data.results[model2]?.summary || "ααααΆααααααα"; | |
| } else { | |
| alert("ααΆααααα αΆαααα»αααΆαααααααα"); | |
| } | |
| } catch (err) { | |
| console.error(err); | |
| alert("ααΆααααα αΆαααα»αααΆαααααααα ααΌαααααΆααΆααααααααα"); | |
| } | |
| } | |
| // Clear outputs if input is empty | |
| inputDiv.addEventListener("input", () => { | |
| if (!inputDiv.textContent.trim()) { | |
| output1Div.innerHTML = ""; | |
| output2Div.innerHTML = ""; | |
| } | |
| }); | |