Upload app.py
Browse files
app.py
CHANGED
|
@@ -67,14 +67,18 @@ def score_widget(score):
|
|
| 67 |
)
|
| 68 |
|
| 69 |
|
|
|
|
|
|
|
| 70 |
def md_to_html_highlighted(text_md, qwords):
|
| 71 |
-
"""Convertit le markdown en HTML
|
| 72 |
if not text_md:
|
| 73 |
return ""
|
| 74 |
html = md_lib.markdown(text_md, extensions=["nl2br", "sane_lists"])
|
|
|
|
|
|
|
|
|
|
| 75 |
if qwords:
|
| 76 |
for w in qwords:
|
| 77 |
-
# Surlignage sombre (fond foncé + texte blanc) pour lisibilité
|
| 78 |
html = re.sub(
|
| 79 |
r"(?<![<\w])(" + re.escape(w) + r")(?![>\w])",
|
| 80 |
r'<mark>\1</mark>',
|
|
@@ -118,11 +122,12 @@ def render_cards(results_df, scores=None, qwords=None):
|
|
| 118 |
# Aperçu HTML du markdown avec surlignage
|
| 119 |
preview_html = md_to_html_highlighted(texte_md, qwords)
|
| 120 |
preview_block = f"""
|
| 121 |
-
<div
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
<div style="
|
| 125 |
-
|
|
|
|
| 126 |
</div>"""
|
| 127 |
|
| 128 |
annonce_btn = (
|
|
@@ -320,12 +325,8 @@ mark { background: #92400e; color: #fff !important; border-radius: 3px; padding:
|
|
| 320 |
|
| 321 |
query_input = gr.Textbox(
|
| 322 |
elem_id="query", label="",
|
| 323 |
-
placeholder=
|
| 324 |
-
|
| 325 |
-
"ou : chef de service, télécoms, RH, marketing...\n"
|
| 326 |
-
"Entrée pour lancer la recherche"
|
| 327 |
-
),
|
| 328 |
-
lines=3, max_lines=4, show_label=False,
|
| 329 |
)
|
| 330 |
|
| 331 |
with gr.Row():
|
|
|
|
| 67 |
)
|
| 68 |
|
| 69 |
|
| 70 |
+
GRAY = "color:#6b7280 !important"
|
| 71 |
+
|
| 72 |
def md_to_html_highlighted(text_md, qwords):
|
| 73 |
+
"""Convertit le markdown en HTML, force les couleurs inline, surligne les mots-clés."""
|
| 74 |
if not text_md:
|
| 75 |
return ""
|
| 76 |
html = md_lib.markdown(text_md, extensions=["nl2br", "sane_lists"])
|
| 77 |
+
for tag in ("p", "li", "ul", "ol", "h1", "h2", "h3", "h4", "strong", "em"):
|
| 78 |
+
html = html.replace(f"<{tag}>", f'<{tag} style="{GRAY}">')
|
| 79 |
+
html = re.sub(f'<{tag} ((?!style=)[^>]*)>', f'<{tag} style="{GRAY}" \\1>', html)
|
| 80 |
if qwords:
|
| 81 |
for w in qwords:
|
|
|
|
| 82 |
html = re.sub(
|
| 83 |
r"(?<![<\w])(" + re.escape(w) + r")(?![>\w])",
|
| 84 |
r'<mark>\1</mark>',
|
|
|
|
| 122 |
# Aperçu HTML du markdown avec surlignage
|
| 123 |
preview_html = md_to_html_highlighted(texte_md, qwords)
|
| 124 |
preview_block = f"""
|
| 125 |
+
<div style="font-size:12px;line-height:1.5;margin-top:10px;max-height:150px;
|
| 126 |
+
overflow:hidden;position:relative;
|
| 127 |
+
color:#6b7280 !important">
|
| 128 |
+
<div style="color:#6b7280 !important">{preview_html}</div>
|
| 129 |
+
<div style="position:absolute;bottom:0;left:0;right:0;height:36px;
|
| 130 |
+
background:linear-gradient(rgba(255,255,255,0),rgba(30,30,30,0.01))"></div>
|
| 131 |
</div>"""
|
| 132 |
|
| 133 |
annonce_btn = (
|
|
|
|
| 325 |
|
| 326 |
query_input = gr.Textbox(
|
| 327 |
elem_id="query", label="",
|
| 328 |
+
placeholder='Ex: "Cadre expérimenté en gestion de projets SI et management" — Entrée pour rechercher',
|
| 329 |
+
lines=1, max_lines=6, show_label=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
)
|
| 331 |
|
| 332 |
with gr.Row():
|