student2222333051 commited on
Commit
fc5f00b
·
verified ·
1 Parent(s): 1c401c5

Update script.js

Browse files
Files changed (1) hide show
  1. script.js +4 -20
script.js CHANGED
@@ -1,26 +1,10 @@
1
- async function summarizeText() {
2
  const text = document.getElementById("inputText").value;
3
-
4
  const response = await fetch("/summarize/text", {
5
  method: "POST",
6
- headers: {"Content-Type": "application/json"},
7
- body: JSON.stringify({ text })
8
  });
9
-
10
  const data = await response.json();
11
- document.getElementById("summaryBox").innerText = data.summary;
12
- }
13
-
14
- async function summarizePDF() {
15
- const file = document.getElementById("pdfFile").files[0];
16
- const formData = new FormData();
17
- formData.append("file", file);
18
-
19
- const response = await fetch("/summarize/pdf", {
20
- method: "POST",
21
- body: formData
22
- });
23
-
24
- const data = await response.json();
25
- document.getElementById("summaryBox").innerText = data.summary;
26
  }
 
1
+ async function summarize() {
2
  const text = document.getElementById("inputText").value;
 
3
  const response = await fetch("/summarize/text", {
4
  method: "POST",
5
+ headers: { "Content-Type": "application/json" },
6
+ body: JSON.stringify({ text: text })
7
  });
 
8
  const data = await response.json();
9
+ document.getElementById("result").innerText = data.summary;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  }