-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
78 lines (62 loc) · 2.47 KB
/
Copy pathindex.html
File metadata and controls
78 lines (62 loc) · 2.47 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Personal Assistant</title>
<link rel="stylesheet" href="{{ url_for('static',filename='style.css')}}">
</head>
<body>
<h1 class="main-heading">AI Personal Assistant</h1>
<div class="page-layout">
<div class="robot-side">
<img src="{{ url_for('static',filename='image/robot.png')}}" alt="AI Robot" class="robot-img">
</div>
<div class="container">
<h2>Ask Anything</h2>
<form action="" id="askForm">
<input type="text" name="question" id="" placeholder="Ask Anything..." required>
<button type="submit">Ask</button>
</form>
<p id="ans-loading" style="display:none;">Processing...</p>
<p id="answer"></p>
<hr>
<h2>Summarize Email</h2>
<form action="" id="emailForm">
<textarea type="text" name="email" id="" placeholder="paste your email here..." required></textarea>
<button type="submit">Summarize</button>
</form>
<p id="summary-loading" style="display:none;">Processing...</p>
<p id="summary"></p>
</div>
</div>
<script>
document.getElementById("askForm").onsubmit = async (e) => {
e.preventDefault();
let formData = new FormData(e.target);
let loading = document.getElementById("ans-loading");
loading.style.display = "block"; // show loader
let res = await fetch("/ask",{
method:"POST",
body: formData
});
let data = await res.json();
document.getElementById("answer").innerText = data.response;
loading.style.display = "none"; // hide loader
};
document.getElementById("emailForm").onsubmit = async (e) => {
e.preventDefault();
let formData = new FormData(e.target);
let loading = document.getElementById("summary-loading");
loading.style.display = "block";
let res = await fetch("/summarize", {
method: "POST",
body: formData
});
let data = await res.json();
document.getElementById("summary").innerText = data.response;
loading.style.display = "none"; // hide loader
};
</script>
</body>
</html>