Shabdobhedi commited on
Commit
2a01a57
·
verified ·
1 Parent(s): 8cd3b6b

update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
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"<mark>{keyword}</mark>")
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")