Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -464,16 +464,6 @@ incomplete_with_desc = metadata_df[
|
|
464 |
(metadata_df['subject'].isnull())
|
465 |
]
|
466 |
|
467 |
-
# Create a consistent container for the results
|
468 |
-
st.markdown("""
|
469 |
-
<div style='
|
470 |
-
background-color: #1e1e1e;
|
471 |
-
border-radius: 10px;
|
472 |
-
padding: 1rem;
|
473 |
-
margin-top: 1rem;
|
474 |
-
'>
|
475 |
-
""", unsafe_allow_html=True)
|
476 |
-
|
477 |
if not incomplete_with_desc.empty:
|
478 |
if use_ai:
|
479 |
suggestions = []
|
@@ -498,41 +488,58 @@ if not incomplete_with_desc.empty:
|
|
498 |
if suggestions:
|
499 |
suggestions_df = pd.DataFrame(suggestions, columns=["Title", "Suggested Subject"])
|
500 |
|
501 |
-
#
|
502 |
-
|
503 |
-
<style>
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
padding: 12px;
|
514 |
-
text-align: left;
|
515 |
-
border-bottom: 1px solid #444;
|
516 |
-
}
|
517 |
-
tr:hover {
|
518 |
-
background-color: #2c2c2c;
|
519 |
-
}
|
520 |
-
</style>
|
521 |
-
""", unsafe_allow_html=True)
|
522 |
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
530 |
else:
|
531 |
-
st.
|
|
|
|
|
|
|
|
|
532 |
else:
|
533 |
-
st.
|
|
|
|
|
|
|
|
|
534 |
else:
|
535 |
-
st.
|
536 |
-
|
537 |
-
|
|
|
|
|
538 |
|
|
|
464 |
(metadata_df['subject'].isnull())
|
465 |
]
|
466 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
467 |
if not incomplete_with_desc.empty:
|
468 |
if use_ai:
|
469 |
suggestions = []
|
|
|
488 |
if suggestions:
|
489 |
suggestions_df = pd.DataFrame(suggestions, columns=["Title", "Suggested Subject"])
|
490 |
|
491 |
+
# Create a custom dark-styled HTML table instead
|
492 |
+
html_table = """
|
493 |
+
<div style="background-color: #1e1e1e; padding: 1.5rem; border-radius: 10px; margin-top: 1rem;">
|
494 |
+
<table style="width: 100%; border-collapse: collapse; color: #e0e0e0;">
|
495 |
+
<thead>
|
496 |
+
<tr style="border-bottom: 1px solid #444;">
|
497 |
+
<th style="padding: 12px; text-align: left; color: #e0e0e0;">Title</th>
|
498 |
+
<th style="padding: 12px; text-align: left; color: #e0e0e0;">Suggested Subject</th>
|
499 |
+
</tr>
|
500 |
+
</thead>
|
501 |
+
<tbody>
|
502 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
|
504 |
+
for _, row in suggestions_df.iterrows():
|
505 |
+
title = row['Title']
|
506 |
+
title_display = title[:50] + "..." if len(title) > 50 else title
|
507 |
+
subject = row['Suggested Subject']
|
508 |
+
|
509 |
+
# Calculate a shade of green based on confidence or some other metric
|
510 |
+
# For demonstration, using a fixed green shade
|
511 |
+
green_shade = "rgba(0, 100, 0, 0.3)"
|
512 |
+
|
513 |
+
html_table += f"""
|
514 |
+
<tr style="border-bottom: 1px solid #444;">
|
515 |
+
<td style="padding: 12px; text-align: left;">{title_display}</td>
|
516 |
+
<td style="padding: 12px; text-align: left; background-color: {green_shade};">{subject}</td>
|
517 |
+
</tr>
|
518 |
+
"""
|
519 |
+
|
520 |
+
html_table += """
|
521 |
+
</tbody>
|
522 |
+
</table>
|
523 |
+
</div>
|
524 |
+
"""
|
525 |
+
|
526 |
+
st.markdown(html_table, unsafe_allow_html=True)
|
527 |
else:
|
528 |
+
st.markdown("""
|
529 |
+
<div style="background-color: #1e1e1e; padding: 1.5rem; border-radius: 10px; margin-top: 1rem; color: #e0e0e0;">
|
530 |
+
No metadata enhancement suggestions available.
|
531 |
+
</div>
|
532 |
+
""", unsafe_allow_html=True)
|
533 |
else:
|
534 |
+
st.markdown("""
|
535 |
+
<div style="background-color: #1e1e1e; padding: 1.5rem; border-radius: 10px; margin-top: 1rem; color: #e0e0e0;">
|
536 |
+
Enable AI Suggestions to view recommendations.
|
537 |
+
</div>
|
538 |
+
""", unsafe_allow_html=True)
|
539 |
else:
|
540 |
+
st.markdown("""
|
541 |
+
<div style="background-color: #1e1e1e; padding: 1.5rem; border-radius: 10px; margin-top: 1rem; color: #e0e0e0;">
|
542 |
+
All records already have subjects or no usable text available.
|
543 |
+
</div>
|
544 |
+
""", unsafe_allow_html=True)
|
545 |
|