Spaces:
Build error
Build error
update app.py
Browse files
app.py
CHANGED
|
@@ -33,8 +33,19 @@ if uploaded_file is not None:
|
|
| 33 |
if keyword:
|
| 34 |
|
| 35 |
|
| 36 |
-
highlighted_text = full_text.replace(keyword, f"<
|
| 37 |
st.subheader("Highlighted Search Results")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
st.markdown(highlighted_text, unsafe_allow_html=True)
|
| 39 |
else:
|
| 40 |
st.subheader("Highlighted Search Results")
|
|
|
|
| 33 |
if keyword:
|
| 34 |
|
| 35 |
|
| 36 |
+
highlighted_text = full_text.replace(keyword, f"<span class='highlight'>{keyword}</span>)")
|
| 37 |
st.subheader("Highlighted Search Results")
|
| 38 |
+
# CSS styles for highlighting
|
| 39 |
+
st.markdown('''
|
| 40 |
+
<style>
|
| 41 |
+
.highlight {
|
| 42 |
+
background-color: yellow;
|
| 43 |
+
color: black;
|
| 44 |
+
padding: 0.2em;
|
| 45 |
+
border-radius: 4px;
|
| 46 |
+
}
|
| 47 |
+
</style>
|
| 48 |
+
''', unsafe_allow_html=True)
|
| 49 |
st.markdown(highlighted_text, unsafe_allow_html=True)
|
| 50 |
else:
|
| 51 |
st.subheader("Highlighted Search Results")
|