Hadiil commited on
Commit
0e132dc
·
verified ·
1 Parent(s): 54f3bcb

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +5 -18
static/index.html CHANGED
@@ -19,7 +19,7 @@
19
  form {
20
  margin-bottom: 20px;
21
  }
22
- input[type="file"], textarea, button {
23
  display: block;
24
  margin: 10px 0;
25
  padding: 10px;
@@ -41,8 +41,6 @@
41
  <h2>Document Summarization</h2>
42
  <form id="summarizeForm">
43
  <input type="file" id="document" name="document" accept=".pdf,.docx">
44
- <p>Or</p>
45
- <textarea id="manualText" name="text" placeholder="Enter text manually"></textarea>
46
  <button type="submit">Summarize</button>
47
  </form>
48
  <div class="result" id="summaryResult"></div>
@@ -59,8 +57,6 @@
59
  <h2>Text-Based Question Answering</h2>
60
  <form id="qaForm">
61
  <input type="file" id="qaDocument" name="document" accept=".pdf,.docx">
62
- <p>Or</p>
63
- <textarea id="qaText" name="text" placeholder="Enter text manually"></textarea>
64
  <input type="text" id="question" name="question" placeholder="Enter your question">
65
  <button type="submit">Ask</button>
66
  </form>
@@ -82,20 +78,11 @@
82
  event.preventDefault();
83
  const formData = new FormData();
84
  const fileInput = event.target.querySelector('input[type="file"]');
85
- const textInput = event.target.querySelector('textarea');
86
- const questionInput = event.target.querySelector('input[type="text"]');
87
 
88
- if (fileInput.files[0]) {
89
- formData.append("file", fileInput.files[0]);
90
- } else if (textInput && textInput.value) {
91
- formData.append("text", textInput.value);
92
- } else {
93
- alert("Please upload a file or enter text manually.");
94
- return;
95
- }
96
-
97
- if (questionInput) {
98
- formData.append("question", questionInput.value);
99
  }
100
 
101
  const response = await fetch(endpoint, {
 
19
  form {
20
  margin-bottom: 20px;
21
  }
22
+ input[type="file"], input[type="text"], button {
23
  display: block;
24
  margin: 10px 0;
25
  padding: 10px;
 
41
  <h2>Document Summarization</h2>
42
  <form id="summarizeForm">
43
  <input type="file" id="document" name="document" accept=".pdf,.docx">
 
 
44
  <button type="submit">Summarize</button>
45
  </form>
46
  <div class="result" id="summaryResult"></div>
 
57
  <h2>Text-Based Question Answering</h2>
58
  <form id="qaForm">
59
  <input type="file" id="qaDocument" name="document" accept=".pdf,.docx">
 
 
60
  <input type="text" id="question" name="question" placeholder="Enter your question">
61
  <button type="submit">Ask</button>
62
  </form>
 
78
  event.preventDefault();
79
  const formData = new FormData();
80
  const fileInput = event.target.querySelector('input[type="file"]');
81
+ const textInput = event.target.querySelector('input[type="text"]');
 
82
 
83
+ formData.append("file", fileInput.files[0]);
84
+ if (textInput) {
85
+ formData.append("question", textInput.value);
 
 
 
 
 
 
 
 
86
  }
87
 
88
  const response = await fetch(endpoint, {