few code cleaning
Browse files- front/utils.py +5 -5
- style.css +1 -55
front/utils.py
CHANGED
|
@@ -8,12 +8,12 @@ from io import BytesIO
|
|
| 8 |
import base64
|
| 9 |
|
| 10 |
|
| 11 |
-
def make_pairs(lst):
|
| 12 |
"""from a list of even lenght, make tupple pairs"""
|
| 13 |
return [(lst[i], lst[i + 1]) for i in range(0, len(lst), 2)]
|
| 14 |
|
| 15 |
|
| 16 |
-
def serialize_docs(docs):
|
| 17 |
new_docs = []
|
| 18 |
for doc in docs:
|
| 19 |
new_doc = {}
|
|
@@ -24,7 +24,7 @@ def serialize_docs(docs):
|
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
-
def parse_output_llm_with_sources(output):
|
| 28 |
# Split the content into a list of text and "[Doc X]" references
|
| 29 |
content_parts = re.split(r'\[(Doc\s?\d+(?:,\s?Doc\s?\d+)*)\]', output)
|
| 30 |
parts = []
|
|
@@ -39,7 +39,7 @@ def parse_output_llm_with_sources(output):
|
|
| 39 |
content_parts = "".join(parts)
|
| 40 |
return content_parts
|
| 41 |
|
| 42 |
-
def process_figures(docs):
|
| 43 |
gallery=[]
|
| 44 |
used_figures =[]
|
| 45 |
figures = '<div class="figures-container"><p></p> </div>'
|
|
@@ -76,7 +76,7 @@ def process_figures(docs):
|
|
| 76 |
return figures, gallery
|
| 77 |
|
| 78 |
|
| 79 |
-
def generate_html_graphs(graphs):
|
| 80 |
# Organize graphs by category
|
| 81 |
categories = defaultdict(list)
|
| 82 |
for graph in graphs:
|
|
|
|
| 8 |
import base64
|
| 9 |
|
| 10 |
|
| 11 |
+
def make_pairs(lst:list)->list:
|
| 12 |
"""from a list of even lenght, make tupple pairs"""
|
| 13 |
return [(lst[i], lst[i + 1]) for i in range(0, len(lst), 2)]
|
| 14 |
|
| 15 |
|
| 16 |
+
def serialize_docs(docs:list)->list:
|
| 17 |
new_docs = []
|
| 18 |
for doc in docs:
|
| 19 |
new_doc = {}
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
+
def parse_output_llm_with_sources(output:str)->str:
|
| 28 |
# Split the content into a list of text and "[Doc X]" references
|
| 29 |
content_parts = re.split(r'\[(Doc\s?\d+(?:,\s?Doc\s?\d+)*)\]', output)
|
| 30 |
parts = []
|
|
|
|
| 39 |
content_parts = "".join(parts)
|
| 40 |
return content_parts
|
| 41 |
|
| 42 |
+
def process_figures(docs:list)->tuple:
|
| 43 |
gallery=[]
|
| 44 |
used_figures =[]
|
| 45 |
figures = '<div class="figures-container"><p></p> </div>'
|
|
|
|
| 76 |
return figures, gallery
|
| 77 |
|
| 78 |
|
| 79 |
+
def generate_html_graphs(graphs:list)->str:
|
| 80 |
# Organize graphs by category
|
| 81 |
categories = defaultdict(list)
|
| 82 |
for graph in graphs:
|
style.css
CHANGED
|
@@ -53,14 +53,6 @@
|
|
| 53 |
transition: background-color 0.3s ease;
|
| 54 |
}
|
| 55 |
|
| 56 |
-
.avatar-container.svelte-1x5p6hu:not(.thumbnail-item) img {
|
| 57 |
-
width: 100%;
|
| 58 |
-
height: 100%;
|
| 59 |
-
object-fit: cover;
|
| 60 |
-
border-radius: 50%;
|
| 61 |
-
padding: 0px;
|
| 62 |
-
margin: 0px;
|
| 63 |
-
}
|
| 64 |
|
| 65 |
.gradio-container {
|
| 66 |
width: 100%!important;
|
|
@@ -229,51 +221,6 @@ a {
|
|
| 229 |
border:none;
|
| 230 |
}
|
| 231 |
|
| 232 |
-
/* .gallery-item > div:hover{
|
| 233 |
-
background-color:#7494b0 !important;
|
| 234 |
-
color:white!important;
|
| 235 |
-
}
|
| 236 |
-
|
| 237 |
-
.gallery-item:hover{
|
| 238 |
-
border:#7494b0 !important;
|
| 239 |
-
}
|
| 240 |
-
|
| 241 |
-
.gallery-item > div{
|
| 242 |
-
background-color:white !important;
|
| 243 |
-
color:#577b9b!important;
|
| 244 |
-
}
|
| 245 |
-
|
| 246 |
-
.label{
|
| 247 |
-
color:#577b9b!important;
|
| 248 |
-
} */
|
| 249 |
-
|
| 250 |
-
/* .paginate{
|
| 251 |
-
color:#577b9b!important;
|
| 252 |
-
} */
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
/* span[data-testid="block-info"]{
|
| 257 |
-
background:none !important;
|
| 258 |
-
color:#577b9b;
|
| 259 |
-
} */
|
| 260 |
-
|
| 261 |
-
/* Pseudo-element for the circularly cropped picture */
|
| 262 |
-
/* .message.bot::before {
|
| 263 |
-
content: '';
|
| 264 |
-
position: absolute;
|
| 265 |
-
top: -10px;
|
| 266 |
-
left: -10px;
|
| 267 |
-
width: 30px;
|
| 268 |
-
height: 30px;
|
| 269 |
-
background-image: var(--user-image);
|
| 270 |
-
background-size: cover;
|
| 271 |
-
background-position: center;
|
| 272 |
-
border-radius: 50%;
|
| 273 |
-
z-index: 10;
|
| 274 |
-
}
|
| 275 |
-
*/
|
| 276 |
-
|
| 277 |
|
| 278 |
label.selected{
|
| 279 |
background: #93c5fd !important;
|
|
@@ -591,8 +538,7 @@ span.chatbot > p > img{
|
|
| 591 |
}
|
| 592 |
|
| 593 |
#dropdown-samples{
|
| 594 |
-
|
| 595 |
-
/*! border-width:0px !important; */
|
| 596 |
background:none !important;
|
| 597 |
|
| 598 |
}
|
|
|
|
| 53 |
transition: background-color 0.3s ease;
|
| 54 |
}
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
.gradio-container {
|
| 58 |
width: 100%!important;
|
|
|
|
| 221 |
border:none;
|
| 222 |
}
|
| 223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
|
| 225 |
label.selected{
|
| 226 |
background: #93c5fd !important;
|
|
|
|
| 538 |
}
|
| 539 |
|
| 540 |
#dropdown-samples{
|
| 541 |
+
|
|
|
|
| 542 |
background:none !important;
|
| 543 |
|
| 544 |
}
|