Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -162,11 +162,7 @@ st.markdown("""
|
|
162 |
max-width: 95%;
|
163 |
padding-left: 3rem;
|
164 |
padding-right: 3rem;
|
165 |
-
|
166 |
-
.stDataFrame div {
|
167 |
-
background-color: #2e2e2e !important;
|
168 |
-
color: lightgray !important;
|
169 |
-
}
|
170 |
}
|
171 |
|
172 |
</style>
|
@@ -455,13 +451,13 @@ if fetch_data:
|
|
455 |
incomplete_records = metadata_df[incomplete_mask]
|
456 |
|
457 |
|
458 |
-
# Suggested Metadata Enhancements Section
|
459 |
st.subheader("Suggested Metadata Enhancements")
|
460 |
|
461 |
# Always show the checkbox
|
462 |
-
use_ai = st.checkbox("Use AI Suggestions", value=True)
|
463 |
|
464 |
-
#
|
465 |
incomplete_with_desc = metadata_df[
|
466 |
(metadata_df['description'].notnull() | metadata_df['title'].notnull()) &
|
467 |
(metadata_df['subject'].isnull())
|
@@ -495,14 +491,15 @@ if not incomplete_with_desc.empty:
|
|
495 |
|
496 |
if suggestions:
|
497 |
suggestions_df = pd.DataFrame(suggestions, columns=["Title", "Suggested Subject"])
|
498 |
-
|
|
|
499 |
styled_suggestions = (
|
500 |
suggestions_df.style
|
501 |
.background_gradient(cmap="Greens", subset=["Suggested Subject"])
|
502 |
.hide(axis="index")
|
503 |
)
|
504 |
-
|
505 |
-
#
|
506 |
st.markdown("""
|
507 |
<div style='
|
508 |
background-color: #2e2e2e;
|
@@ -512,19 +509,30 @@ if not incomplete_with_desc.empty:
|
|
512 |
color: lightgray;
|
513 |
'>
|
514 |
""", unsafe_allow_html=True)
|
515 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
516 |
st.dataframe(
|
517 |
styled_suggestions,
|
518 |
use_container_width=True,
|
519 |
hide_index=True,
|
520 |
height=min(300, len(suggestions) * 35 + 38)
|
521 |
)
|
522 |
-
|
523 |
-
st.markdown("</div>", unsafe_allow_html=True)
|
|
|
524 |
else:
|
525 |
st.info("No metadata enhancement suggestions available.")
|
526 |
|
527 |
-
|
528 |
else:
|
529 |
st.info("Enable AI Suggestions to view recommendations.")
|
530 |
else:
|
|
|
162 |
max-width: 95%;
|
163 |
padding-left: 3rem;
|
164 |
padding-right: 3rem;
|
165 |
+
|
|
|
|
|
|
|
|
|
166 |
}
|
167 |
|
168 |
</style>
|
|
|
451 |
incomplete_records = metadata_df[incomplete_mask]
|
452 |
|
453 |
|
454 |
+
# --- Suggested Metadata Enhancements Section ---
|
455 |
st.subheader("Suggested Metadata Enhancements")
|
456 |
|
457 |
# Always show the checkbox
|
458 |
+
use_ai = st.checkbox("🤖 Use AI Suggestions (Hugging Face)", value=True)
|
459 |
|
460 |
+
# Check if records exist
|
461 |
incomplete_with_desc = metadata_df[
|
462 |
(metadata_df['description'].notnull() | metadata_df['title'].notnull()) &
|
463 |
(metadata_df['subject'].isnull())
|
|
|
491 |
|
492 |
if suggestions:
|
493 |
suggestions_df = pd.DataFrame(suggestions, columns=["Title", "Suggested Subject"])
|
494 |
+
|
495 |
+
# --- Apply Style ---
|
496 |
styled_suggestions = (
|
497 |
suggestions_df.style
|
498 |
.background_gradient(cmap="Greens", subset=["Suggested Subject"])
|
499 |
.hide(axis="index")
|
500 |
)
|
501 |
+
|
502 |
+
# --- Display inside Dark Card ---
|
503 |
st.markdown("""
|
504 |
<div style='
|
505 |
background-color: #2e2e2e;
|
|
|
509 |
color: lightgray;
|
510 |
'>
|
511 |
""", unsafe_allow_html=True)
|
512 |
+
|
513 |
+
# --- Inject Extra CSS to override DataFrame inside ---
|
514 |
+
st.markdown("""
|
515 |
+
<style>
|
516 |
+
div[data-testid="stDataFrame"] div {
|
517 |
+
background-color: #2e2e2e !important;
|
518 |
+
color: lightgray !important;
|
519 |
+
}
|
520 |
+
</style>
|
521 |
+
""", unsafe_allow_html=True)
|
522 |
+
|
523 |
+
# --- Actual Table ---
|
524 |
st.dataframe(
|
525 |
styled_suggestions,
|
526 |
use_container_width=True,
|
527 |
hide_index=True,
|
528 |
height=min(300, len(suggestions) * 35 + 38)
|
529 |
)
|
530 |
+
|
531 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
532 |
+
|
533 |
else:
|
534 |
st.info("No metadata enhancement suggestions available.")
|
535 |
|
|
|
536 |
else:
|
537 |
st.info("Enable AI Suggestions to view recommendations.")
|
538 |
else:
|