UniquePratham commited on
Commit
7297505
1 Parent(s): b7a1777

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -107,9 +107,9 @@ def extract_text_qwen(image_file, model, processor):
107
  # Function to highlight the keyword in the text
108
 
109
 
110
- def highlight_text(cleaned_text, start, end):
111
  text_highlighter(
112
- text=cleaned_text,
113
  labels=[("KEYWORD", "#0000FF")],
114
  annotations=[
115
  {"start": start, "end": end, "tag": "KEYWORD"},
@@ -218,11 +218,11 @@ if uploaded_file:
218
  search_query = st_keyup("Search in extracted text:")
219
 
220
  if search_query:
221
- index = cleaned_text.find(search_query)
222
  start = index
223
  len = search_query.length
224
  end = index + len
225
  if index != -1:
226
- highlight_text(cleaned_text, start, end)
227
  else:
228
  st.write("No Search Found.")
 
107
  # Function to highlight the keyword in the text
108
 
109
 
110
+ def highlight_text(text_sentence, start, end):
111
  text_highlighter(
112
+ text=text_sentence,
113
  labels=[("KEYWORD", "#0000FF")],
114
  annotations=[
115
  {"start": start, "end": end, "tag": "KEYWORD"},
 
218
  search_query = st_keyup("Search in extracted text:")
219
 
220
  if search_query:
221
+ index = extracted_text.find(search_query)
222
  start = index
223
  len = search_query.length
224
  end = index + len
225
  if index != -1:
226
+ highlight_text(extracted_text, start, end)
227
  else:
228
  st.write("No Search Found.")