Spaces:
Sleeping
Sleeping
ikram
commited on
Commit
·
1c0739a
1
Parent(s):
b9e753c
collect all the services
Browse files- Summarization/.gitattributes +0 -35
- app.py → Summarization/app.py +0 -0
- appImage.py → Summarization/appImage.py +0 -0
- main.py → Summarization/main.py +0 -0
- static/app.css +214 -0
- static/application.js +186 -0
- static/hellopageStyle.css +92 -0
- static/hellopagejs.js +0 -0
- templates/hellopage.html +38 -0
- templates/home.html +38 -0
Summarization/.gitattributes
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py → Summarization/app.py
RENAMED
|
File without changes
|
appImage.py → Summarization/appImage.py
RENAMED
|
File without changes
|
main.py → Summarization/main.py
RENAMED
|
File without changes
|
static/app.css
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
* {
|
| 2 |
+
margin: 0;
|
| 3 |
+
padding: 0;
|
| 4 |
+
box-sizing: border-box;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
html, body {
|
| 8 |
+
height: 100vh;
|
| 9 |
+
width: 100vw;
|
| 10 |
+
font-family: sans-serif;
|
| 11 |
+
background-color: white;
|
| 12 |
+
display: flex;
|
| 13 |
+
flex-direction: column;
|
| 14 |
+
}
|
| 15 |
+
/* Drag & Drop Feedback */
|
| 16 |
+
.drag-active {
|
| 17 |
+
background-color: rgba(0, 150, 255, 0.1) !important;
|
| 18 |
+
border: 2px dashed #1ec9f3 !important;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
header {
|
| 22 |
+
flex: 0 0 17vh;
|
| 23 |
+
display: flex;
|
| 24 |
+
align-items: center;
|
| 25 |
+
gap: 20px;
|
| 26 |
+
padding: 0 20px;
|
| 27 |
+
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
header img {
|
| 31 |
+
height: 18vh;
|
| 32 |
+
width: 5vw;
|
| 33 |
+
object-fit: cover;
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
header span {
|
| 37 |
+
font-size: 30px;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
em {
|
| 41 |
+
color: rgb(42, 42, 248);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
.convo {
|
| 46 |
+
height: 70vh;
|
| 47 |
+
overflow-y: auto;
|
| 48 |
+
padding: 10px;
|
| 49 |
+
display: flex;
|
| 50 |
+
flex-direction: column;
|
| 51 |
+
gap: 10px;
|
| 52 |
+
scroll-behavior: smooth;
|
| 53 |
+
flex: 1;
|
| 54 |
+
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
.bubble {
|
| 59 |
+
max-width: 90%;
|
| 60 |
+
padding: 16px;
|
| 61 |
+
font-size: 1.05rem;
|
| 62 |
+
border-radius: 14px;
|
| 63 |
+
word-wrap: break-word;
|
| 64 |
+
white-space: pre-wrap;
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
.bubble .label {
|
| 68 |
+
font-size: 0.9rem;
|
| 69 |
+
font-weight: bold;
|
| 70 |
+
margin-bottom: 6px;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
.bubble.left {
|
| 74 |
+
align-self: flex-start;
|
| 75 |
+
background-color: #a7e9af;
|
| 76 |
+
color: black;
|
| 77 |
+
border: 2px solid #3b7a57;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.bubble.right {
|
| 81 |
+
align-self: flex-end;
|
| 82 |
+
background-color: #1ec9f3;
|
| 83 |
+
color: white;
|
| 84 |
+
border: 2px solid #0080c0;
|
| 85 |
+
}
|
| 86 |
+
.qtdoc {
|
| 87 |
+
flex: 0 0 auto;
|
| 88 |
+
padding: 40px 80px;
|
| 89 |
+
display: flex;
|
| 90 |
+
justify-content: center;
|
| 91 |
+
align-items: center;
|
| 92 |
+
box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
.qt {
|
| 97 |
+
flex: 1;
|
| 98 |
+
display: flex;
|
| 99 |
+
align-items: center;
|
| 100 |
+
justify-content: space-between;
|
| 101 |
+
background-color: #b5b4b4;
|
| 102 |
+
border-radius: 10px;
|
| 103 |
+
margin-right: 10px;
|
| 104 |
+
padding: 0 10px;
|
| 105 |
+
height: 50px;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
.qt input {
|
| 109 |
+
width: 70%;
|
| 110 |
+
height: 70%;
|
| 111 |
+
border: none;
|
| 112 |
+
background-color: #b5b4b4;
|
| 113 |
+
color: white;
|
| 114 |
+
font-size: 16px;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
.qt input::placeholder {
|
| 118 |
+
color: white;
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
.qt input:focus {
|
| 122 |
+
outline: none;
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
.icons {
|
| 127 |
+
display: flex;
|
| 128 |
+
gap: 40px;
|
| 129 |
+
font-size: 20px;
|
| 130 |
+
color: white;
|
| 131 |
+
align-items: center;
|
| 132 |
+
cursor: pointer;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
.sendingQA {
|
| 137 |
+
background-color: #3b82f6;
|
| 138 |
+
color: white;
|
| 139 |
+
padding: 10px 15px;
|
| 140 |
+
border-radius: 8px;
|
| 141 |
+
cursor: pointer;
|
| 142 |
+
border: none;
|
| 143 |
+
font-size: 16px;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.sendingQA:hover {
|
| 147 |
+
background-color: #2563eb;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
.audio-toggle {
|
| 152 |
+
margin-left: 10px;
|
| 153 |
+
cursor: pointer;
|
| 154 |
+
color: #007BFF;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
.audio-toggle:hover {
|
| 158 |
+
color: #0056b3;
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
.answer-block {
|
| 163 |
+
background-color: #e1f7e1;
|
| 164 |
+
border-radius: 10px;
|
| 165 |
+
padding: 1rem;
|
| 166 |
+
margin: 1rem;
|
| 167 |
+
}
|
| 168 |
+
|
| 169 |
+
.file-preview-bubble {
|
| 170 |
+
align-self: flex-start;
|
| 171 |
+
background-color: #f2f2f2;
|
| 172 |
+
color: #444;
|
| 173 |
+
font-size: 0.8rem;
|
| 174 |
+
padding: 6px 10px;
|
| 175 |
+
border-radius: 10px;
|
| 176 |
+
max-width: 50%;
|
| 177 |
+
font-family: monospace;
|
| 178 |
+
box-shadow: inset 0 0 2px #aaa;
|
| 179 |
+
margin: -5px 0 6px 0;
|
| 180 |
+
opacity: 0.9;
|
| 181 |
+
}
|
| 182 |
+
.audio-toggle {
|
| 183 |
+
margin-left: 10px;
|
| 184 |
+
cursor: pointer;
|
| 185 |
+
color: #007BFF;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
.audio-toggle:hover {
|
| 189 |
+
color: #0056b3;
|
| 190 |
+
}
|
| 191 |
+
.reset-chat {
|
| 192 |
+
background-color: #ef4444;
|
| 193 |
+
color: white;
|
| 194 |
+
padding: 8px 16px;
|
| 195 |
+
border: none;
|
| 196 |
+
border-radius: 8px;
|
| 197 |
+
margin-bottom: 10px;
|
| 198 |
+
cursor: pointer;
|
| 199 |
+
font-size: 14px;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
.reset-chat:hover {
|
| 203 |
+
background-color: #dc2626;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
/* Optional: Highlight drop area */
|
| 207 |
+
.convo.drag-over {
|
| 208 |
+
outline: 2px dashed #3b82f6;
|
| 209 |
+
background-color: #e0f2fe;
|
| 210 |
+
}
|
| 211 |
+
.return i{
|
| 212 |
+
font-size: 35px;
|
| 213 |
+
cursor: pointer;
|
| 214 |
+
}
|
static/application.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
document.addEventListener("DOMContentLoaded", () => {
|
| 2 |
+
const convo = document.querySelector(".convo");
|
| 3 |
+
const input = document.querySelector(".qt input");
|
| 4 |
+
const sendBtn = document.querySelector(".sendingQA");
|
| 5 |
+
const fileBtn = document.querySelector(".fa-file");
|
| 6 |
+
const imageBtn = document.querySelector(".fa-image");
|
| 7 |
+
|
| 8 |
+
let selectedFile = null;
|
| 9 |
+
let filePreviewBubble = null;
|
| 10 |
+
|
| 11 |
+
// Hidden file input
|
| 12 |
+
const fileInput = document.createElement("input");
|
| 13 |
+
fileInput.type = "file";
|
| 14 |
+
fileInput.accept = ".pdf,.docx,.pptx,.xlsx,image/*";
|
| 15 |
+
fileInput.style.display = "none";
|
| 16 |
+
document.body.appendChild(fileInput);
|
| 17 |
+
|
| 18 |
+
fileBtn.addEventListener("click", () => fileInput.click());
|
| 19 |
+
imageBtn.addEventListener("click", () => fileInput.click());
|
| 20 |
+
|
| 21 |
+
fileInput.addEventListener("change", () => {
|
| 22 |
+
const file = fileInput.files[0];
|
| 23 |
+
if (file) {
|
| 24 |
+
selectedFile = file;
|
| 25 |
+
if (filePreviewBubble) filePreviewBubble.remove();
|
| 26 |
+
|
| 27 |
+
filePreviewBubble = document.createElement("div");
|
| 28 |
+
filePreviewBubble.className = "file-preview-bubble bubble right";
|
| 29 |
+
filePreviewBubble.textContent = `📎 Selected: ${file.name}`;
|
| 30 |
+
convo.appendChild(filePreviewBubble);
|
| 31 |
+
convo.scrollTop = convo.scrollHeight;
|
| 32 |
+
}
|
| 33 |
+
});
|
| 34 |
+
|
| 35 |
+
function createMessageBubble(text, sender = "You", audioSrc = null, fileName = null) {
|
| 36 |
+
const bubble = document.createElement("div");
|
| 37 |
+
bubble.className = `bubble ${sender === "You" ? "right" : "left"}`;
|
| 38 |
+
|
| 39 |
+
const label = document.createElement("div");
|
| 40 |
+
label.className = "label";
|
| 41 |
+
label.innerText = sender;
|
| 42 |
+
|
| 43 |
+
const message = document.createElement("div");
|
| 44 |
+
message.className = "text";
|
| 45 |
+
message.style.whiteSpace = "pre-wrap";
|
| 46 |
+
|
| 47 |
+
if (sender === "You") {
|
| 48 |
+
let fileLine = fileName ? `📎 Selected file: ${fileName}\n` : "";
|
| 49 |
+
message.innerText = `${fileLine}❓ ${text}`;
|
| 50 |
+
} else {
|
| 51 |
+
message.style.display = "flex";
|
| 52 |
+
message.style.justifyContent = "space-between";
|
| 53 |
+
message.style.alignItems = "center";
|
| 54 |
+
|
| 55 |
+
const msgSpan = document.createElement("span");
|
| 56 |
+
msgSpan.innerText = text;
|
| 57 |
+
message.appendChild(msgSpan);
|
| 58 |
+
|
| 59 |
+
if (audioSrc) {
|
| 60 |
+
const icon = document.createElement("i");
|
| 61 |
+
icon.className = "fa-solid fa-volume-high audio-toggle";
|
| 62 |
+
icon.title = "Click to mute";
|
| 63 |
+
icon.style.cursor = "pointer";
|
| 64 |
+
icon.style.fontSize = "18px";
|
| 65 |
+
|
| 66 |
+
const audio = new Audio(audioSrc);
|
| 67 |
+
audio.play();
|
| 68 |
+
|
| 69 |
+
icon.addEventListener("click", () => {
|
| 70 |
+
if (audio.muted) {
|
| 71 |
+
audio.currentTime = 0;
|
| 72 |
+
audio.muted = false;
|
| 73 |
+
icon.classList.remove("fa-volume-xmark");
|
| 74 |
+
icon.classList.add("fa-volume-high");
|
| 75 |
+
icon.title = "Click to mute";
|
| 76 |
+
audio.play();
|
| 77 |
+
} else {
|
| 78 |
+
audio.muted = true;
|
| 79 |
+
icon.classList.remove("fa-volume-high");
|
| 80 |
+
icon.classList.add("fa-volume-xmark");
|
| 81 |
+
icon.title = "Click to unmute";
|
| 82 |
+
}
|
| 83 |
+
});
|
| 84 |
+
|
| 85 |
+
message.appendChild(icon);
|
| 86 |
+
}
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
bubble.appendChild(label);
|
| 90 |
+
bubble.appendChild(message);
|
| 91 |
+
convo.appendChild(bubble);
|
| 92 |
+
convo.scrollTop = convo.scrollHeight;
|
| 93 |
+
return bubble;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
async function sendMessage() {
|
| 97 |
+
const question = input.value.trim();
|
| 98 |
+
if (!question) return;
|
| 99 |
+
|
| 100 |
+
if (!selectedFile) {
|
| 101 |
+
alert("Please upload a document or image first.");
|
| 102 |
+
return;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
// Remove file preview bubble
|
| 106 |
+
if (filePreviewBubble) {
|
| 107 |
+
filePreviewBubble.remove();
|
| 108 |
+
filePreviewBubble = null;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
// User message with file info
|
| 112 |
+
createMessageBubble(question, "You", null, selectedFile.name);
|
| 113 |
+
|
| 114 |
+
// Aidan is thinking...
|
| 115 |
+
const thinkingBubble = createMessageBubble("Wait, Let me think 🤔...", "Aidan");
|
| 116 |
+
|
| 117 |
+
const formData = new FormData();
|
| 118 |
+
formData.append("question", question);
|
| 119 |
+
formData.append("file", selectedFile);
|
| 120 |
+
|
| 121 |
+
try {
|
| 122 |
+
const response = await fetch("/predict", {
|
| 123 |
+
method: "POST",
|
| 124 |
+
body: formData
|
| 125 |
+
});
|
| 126 |
+
|
| 127 |
+
const result = await response.json();
|
| 128 |
+
const answerText = result.answer || "No response.";
|
| 129 |
+
const audioSrc = result.audio || null;
|
| 130 |
+
|
| 131 |
+
// Replace "Let me think..." with actual answer
|
| 132 |
+
const message = thinkingBubble.querySelector(".text");
|
| 133 |
+
message.innerText = answerText;
|
| 134 |
+
|
| 135 |
+
if (audioSrc) {
|
| 136 |
+
const icon = document.createElement("i");
|
| 137 |
+
icon.className = "fa-solid fa-volume-high audio-toggle";
|
| 138 |
+
icon.title = "Click to mute";
|
| 139 |
+
icon.style.cursor = "pointer";
|
| 140 |
+
icon.style.fontSize = "18px";
|
| 141 |
+
icon.style.marginLeft = "10px";
|
| 142 |
+
|
| 143 |
+
const audio = new Audio(audioSrc);
|
| 144 |
+
audio.play();
|
| 145 |
+
|
| 146 |
+
icon.addEventListener("click", () => {
|
| 147 |
+
if (audio.muted) {
|
| 148 |
+
audio.currentTime = 0;
|
| 149 |
+
audio.muted = false;
|
| 150 |
+
icon.classList.remove("fa-volume-xmark");
|
| 151 |
+
icon.classList.add("fa-volume-high");
|
| 152 |
+
icon.title = "Click to mute";
|
| 153 |
+
audio.play();
|
| 154 |
+
} else {
|
| 155 |
+
audio.muted = true;
|
| 156 |
+
icon.classList.remove("fa-volume-high");
|
| 157 |
+
icon.classList.add("fa-volume-xmark");
|
| 158 |
+
icon.title = "Click to unmute";
|
| 159 |
+
}
|
| 160 |
+
});
|
| 161 |
+
|
| 162 |
+
message.style.display = "flex";
|
| 163 |
+
message.style.justifyContent = "space-between";
|
| 164 |
+
message.appendChild(icon);
|
| 165 |
+
}
|
| 166 |
+
} catch (err) {
|
| 167 |
+
const message = thinkingBubble.querySelector(".text");
|
| 168 |
+
message.innerText = "⚠️ Aidan had trouble responding.";
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
// Clear inputs after processing is complete
|
| 172 |
+
input.value = "";
|
| 173 |
+
selectedFile = null;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
// Click event for send button
|
| 177 |
+
sendBtn.addEventListener("click", sendMessage);
|
| 178 |
+
|
| 179 |
+
// Enter key event for input field
|
| 180 |
+
input.addEventListener("keydown", (event) => {
|
| 181 |
+
if (event.key === "Enter") {
|
| 182 |
+
event.preventDefault(); // Prevent form submission
|
| 183 |
+
sendMessage();
|
| 184 |
+
}
|
| 185 |
+
});
|
| 186 |
+
});
|
static/hellopageStyle.css
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*{
|
| 2 |
+
margin: 0;
|
| 3 |
+
padding: 0;
|
| 4 |
+
box-sizing: border-box;
|
| 5 |
+
}
|
| 6 |
+
|
| 7 |
+
html, body {
|
| 8 |
+
height: 100vh;
|
| 9 |
+
width: 100vw;
|
| 10 |
+
font-family: sans-serif;
|
| 11 |
+
background-color: white;
|
| 12 |
+
display: flex;
|
| 13 |
+
flex-direction: column;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
.titre{
|
| 17 |
+
width: 100%;
|
| 18 |
+
height: 5%;
|
| 19 |
+
display: flex;
|
| 20 |
+
justify-content: center;
|
| 21 |
+
align-items: center;
|
| 22 |
+
font-family: 'Courier New', Courier, monospace;
|
| 23 |
+
font-weight: bold;
|
| 24 |
+
font-size: 40px;
|
| 25 |
+
}
|
| 26 |
+
.robotimage{
|
| 27 |
+
width: 100%;
|
| 28 |
+
height: 25%;
|
| 29 |
+
display: flex;
|
| 30 |
+
justify-content: center;
|
| 31 |
+
align-items: center;
|
| 32 |
+
}
|
| 33 |
+
.robotimage img{
|
| 34 |
+
width: 20vw;
|
| 35 |
+
height: 25vh;
|
| 36 |
+
object-fit: contain;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
.description{
|
| 40 |
+
width: 100%;
|
| 41 |
+
height: 5%;
|
| 42 |
+
display: flex;
|
| 43 |
+
justify-content: center;
|
| 44 |
+
align-items: center;
|
| 45 |
+
font-family: 'Abhaya Libre', serif;
|
| 46 |
+
font-weight: bolder;
|
| 47 |
+
font-size: 20px;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.services{
|
| 51 |
+
width: 100%;
|
| 52 |
+
height: 50%;
|
| 53 |
+
display: flex;
|
| 54 |
+
justify-content: space-around;
|
| 55 |
+
align-items: center;
|
| 56 |
+
}
|
| 57 |
+
.SC ,
|
| 58 |
+
.QA{
|
| 59 |
+
display: flex;
|
| 60 |
+
flex-direction: column;
|
| 61 |
+
align-items: center;
|
| 62 |
+
background-color: #54DDFF;
|
| 63 |
+
height: 55%;
|
| 64 |
+
width: 35%;
|
| 65 |
+
border-radius: 10px;
|
| 66 |
+
cursor: pointer;
|
| 67 |
+
gap: 15%;
|
| 68 |
+
padding: 20px;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
.service_titre{
|
| 72 |
+
font-family: 'Abhaya Libre', serif;
|
| 73 |
+
font-weight: 600;
|
| 74 |
+
font-size: 20px;
|
| 75 |
+
}
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
.SC span,
|
| 79 |
+
.QA span {
|
| 80 |
+
width: 80%;
|
| 81 |
+
font-family: 'Abhaya Libre', sans-serif;
|
| 82 |
+
font-size: 17px;
|
| 83 |
+
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.QA:hover,
|
| 87 |
+
.SC:hover{
|
| 88 |
+
border: 3px solid rgb(91, 91, 253) ;
|
| 89 |
+
box-shadow: 0 4px 15px rgba(0, 0, 255, 0.3);
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
}
|
static/hellopagejs.js
ADDED
|
File without changes
|
templates/hellopage.html
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>AIservices</title>
|
| 7 |
+
<link rel="stylesheet" href="/static/hellopageStyle.css">
|
| 8 |
+
<link href="https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;700&display=swap" rel="stylesheet">
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Abhaya+Libre:wght@400;700&display=swap" rel="stylesheet">
|
| 10 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
| 11 |
+
</head>
|
| 12 |
+
<body>
|
| 13 |
+
<div class="titre">
|
| 14 |
+
<p>AI-Powered</p>
|
| 15 |
+
</div>
|
| 16 |
+
<div class="robotimage">
|
| 17 |
+
<img src="/resource/Hello.png" alt="">
|
| 18 |
+
</div>
|
| 19 |
+
<div class="description">
|
| 20 |
+
<p>Hi there! I’m Aidan, your AI assistant. I Read Files So You Don't Have To!. Here’s how I can help</p>
|
| 21 |
+
</div>
|
| 22 |
+
<div class="services">
|
| 23 |
+
<div class="SC">
|
| 24 |
+
<p class="service_titre">Document & Image Analysis</p>
|
| 25 |
+
<span>Let me be your quick-study assistant ,upload documents or images for instant summaries, clear visual interpretations</span>
|
| 26 |
+
<p class="tryme">try it now</p>
|
| 27 |
+
</div>
|
| 28 |
+
<div class="QA">
|
| 29 |
+
<p class="service_titre">Intelligent Q&A on Files & Images</p>
|
| 30 |
+
<span>Got questions? Just upload your documents or images, and let me provide you with smart, instant answers!</span>
|
| 31 |
+
<p class="tryme">Ask me now</p>
|
| 32 |
+
</div>
|
| 33 |
+
</div>
|
| 34 |
+
<script src="/static/hellopagejs.js"></script>
|
| 35 |
+
</body>
|
| 36 |
+
</html>
|
| 37 |
+
|
| 38 |
+
|
templates/home.html
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>AI Question Answering</title>
|
| 7 |
+
<link rel="stylesheet" href="/static/app.css">
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
| 9 |
+
</head>
|
| 10 |
+
<body>
|
| 11 |
+
<header class="intro">
|
| 12 |
+
<div class="return">
|
| 13 |
+
<i class="fa-solid fa-arrow-left"></i>
|
| 14 |
+
</div>
|
| 15 |
+
<img src="/resources/aiRobot1.png" alt="AI Assistant Chris">
|
| 16 |
+
<span>Hi, I’m <em>Aidan</em>, your AI assistant. How can I help you today?</span>
|
| 17 |
+
</header>
|
| 18 |
+
<div class="convo"></div>
|
| 19 |
+
<div class="qtdoc">
|
| 20 |
+
<div class="qt">
|
| 21 |
+
<input type="text" id="user-input" placeholder="Ask me anything about any document :D">
|
| 22 |
+
<div class="icons">
|
| 23 |
+
<i class="fa-solid fa-image" id="image-btn" title="Upload image"></i>
|
| 24 |
+
<i class="fa-solid fa-file" id="file-btn" title="Upload file"></i>
|
| 25 |
+
<button class="sendingQA">Send</button>
|
| 26 |
+
</div>
|
| 27 |
+
</div>
|
| 28 |
+
</div>
|
| 29 |
+
|
| 30 |
+
<!-- Hidden file inputs (triggered by icons) -->
|
| 31 |
+
<input type="file" id="file-upload" accept=".pdf,.doc,.txt" style="display:none">
|
| 32 |
+
<input type="file" id="image-upload" accept="image/*" style="display:none">
|
| 33 |
+
|
| 34 |
+
<script src="/static/application.js"></script>
|
| 35 |
+
</body>
|
| 36 |
+
</html>
|
| 37 |
+
|
| 38 |
+
|