Shabdobhedi commited on
Commit
b026165
·
verified ·
1 Parent(s): a288d5c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
  from PIL import Image
3
  from ocr_utils import extract_text
4
- from ocr_utils import highlight_content
5
  import numpy as np
6
  # Streamlit application title
7
  st.title("OCR and Keyword Search Application")
@@ -28,15 +28,13 @@ if uploaded_file is not None:
28
  # Text input for keyword search
29
  keyword = st.text_input("Enter Keyword to Search")
30
 
31
-
32
  # Display highlighted content if a keyword is entered
33
  if keyword:
34
 
35
-
36
-
37
- highlighted_text = full_text.replace(keyword, f"<span class='highlight'>{keyword}</span>)")
38
- st.subheader("Highlighted Search Results")
39
- # CSS styles for highlighting
40
  st.markdown('''
41
  <style>
42
  .highlight {
@@ -49,6 +47,5 @@ if uploaded_file is not None:
49
  ''', unsafe_allow_html=True)
50
  st.markdown(highlighted_text, unsafe_allow_html=True)
51
  else:
52
- st.subheader("Highlighted Search Results")
53
- st.write("No keyword entered for highlighting.")
54
-
 
1
  import streamlit as st
2
  from PIL import Image
3
  from ocr_utils import extract_text
4
+
5
  import numpy as np
6
  # Streamlit application title
7
  st.title("OCR and Keyword Search Application")
 
28
  # Text input for keyword search
29
  keyword = st.text_input("Enter Keyword to Search")
30
 
 
31
  # Display highlighted content if a keyword is entered
32
  if keyword:
33
 
34
+ highlighted_text = full_text.replace(
35
+ keyword, f"<span class='highlight'>{keyword}</span>)")
36
+ st.subheader("Highlighted Search Results")
37
+ # CSS styles for highlighting
 
38
  st.markdown('''
39
  <style>
40
  .highlight {
 
47
  ''', unsafe_allow_html=True)
48
  st.markdown(highlighted_text, unsafe_allow_html=True)
49
  else:
50
+ st.subheader("Highlighted Search Results")
51
+ st.write("No keyword entered for highlighting.")