-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
50 lines (47 loc) · 2.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="./static/css/styles.css" />
<title>Apple 2023 Predictions</title>
</head>
<body>
<div class="container">
<h1> Apple 2023 Predictions</h1>
<div class="inner-container"></div>
<div class="user-input">
<textarea id="user-text" placeholder="Start typing..."></textarea>
</div>
<button id="predict-button">
Predict
</button>
<div class="result-input" id="result-input" style="display:none;">
<textarea id="result-text" placeholder="Result will be displayed here..." readonly></textarea>
</div>
<script>
document.getElementById('predict-button').addEventListener('click', async () => {
let query = document.getElementById('user-text').value;
let response = await fetch('http://127.0.0.1:5000/create-footnotes', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
query: query,
template: "{context} Question: {question} Helpful Answer:",
}),
});
let result = await response.json();
console.log(result); // Log the result or display it in your UI
let resultInputDiv = document.getElementById('result-input');
let resultTextarea = document.getElementById('result-text');
resultTextarea.value = JSON.stringify(result, null, 2)
.replace(/\\n/g, '\n') // Replace \n with actual line breaks
.replace(/^"|"$/g, '');
resultInputDiv.style.display = 'block'; // Show result textarea
});
</script>
</body>
</html>