Spaces:
Sleeping
Sleeping
fix ui
Browse files
app.py
CHANGED
|
@@ -119,12 +119,15 @@ def render_results(ids, scores, ui_lang="it"):
|
|
| 119 |
|
| 120 |
html = "<div style='font-family: sans-serif;'>"
|
| 121 |
|
|
|
|
| 122 |
for row in ordered_books:
|
| 123 |
score = scores.get(row[0], 0.0)
|
| 124 |
title, author, year, rating, summary = row[1], row[2], row[3], row[4], row[5]
|
| 125 |
|
| 126 |
# Pulizia
|
| 127 |
author = str(author).replace('"', '').replace("[","").replace("]", "")
|
|
|
|
|
|
|
| 128 |
if not summary: summary = "No summary available."
|
| 129 |
|
| 130 |
main_text = summary
|
|
@@ -173,7 +176,7 @@ def render_results(ids, scores, ui_lang="it"):
|
|
| 173 |
</div>
|
| 174 |
"""
|
| 175 |
html += "</div>"
|
| 176 |
-
return
|
| 177 |
|
| 178 |
# --- FUNZIONI DI RICERCA ---
|
| 179 |
|
|
@@ -260,7 +263,11 @@ with gr.Blocks(theme=gr.themes.Ocean(), css=GLOBAL_CSS, js=JS_FORCE_DARK) as dem
|
|
| 260 |
dataset = gr.Dataset(elem_id="book_cards", components=[gr.Textbox(visible=False)], label="Risultati:", samples=[])
|
| 261 |
|
| 262 |
loader = gr.HTML(value=LOADING_HTML, visible=False)
|
| 263 |
-
results = gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 264 |
|
| 265 |
# EVENTI
|
| 266 |
btn_search.click(search_logic, [txt_in, num_results, lang_selector], [loader, results])
|
|
|
|
| 119 |
|
| 120 |
html = "<div style='font-family: sans-serif;'>"
|
| 121 |
|
| 122 |
+
data = []
|
| 123 |
for row in ordered_books:
|
| 124 |
score = scores.get(row[0], 0.0)
|
| 125 |
title, author, year, rating, summary = row[1], row[2], row[3], row[4], row[5]
|
| 126 |
|
| 127 |
# Pulizia
|
| 128 |
author = str(author).replace('"', '').replace("[","").replace("]", "")
|
| 129 |
+
data.append([title, author, year, rating, f"{score:.3f}"])
|
| 130 |
+
|
| 131 |
if not summary: summary = "No summary available."
|
| 132 |
|
| 133 |
main_text = summary
|
|
|
|
| 176 |
</div>
|
| 177 |
"""
|
| 178 |
html += "</div>"
|
| 179 |
+
return data
|
| 180 |
|
| 181 |
# --- FUNZIONI DI RICERCA ---
|
| 182 |
|
|
|
|
| 263 |
dataset = gr.Dataset(elem_id="book_cards", components=[gr.Textbox(visible=False)], label="Risultati:", samples=[])
|
| 264 |
|
| 265 |
loader = gr.HTML(value=LOADING_HTML, visible=False)
|
| 266 |
+
results = gr.Dataframe(
|
| 267 |
+
headers=["Titolo", "Autore", "Anno", "Rating", "Match"],
|
| 268 |
+
label="Risultati",
|
| 269 |
+
wrap=True
|
| 270 |
+
)
|
| 271 |
|
| 272 |
# EVENTI
|
| 273 |
btn_search.click(search_logic, [txt_in, num_results, lang_selector], [loader, results])
|