Towhidul commited on
Commit
fc87f2b
·
verified ·
1 Parent(s): c9b4422

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -29,7 +29,7 @@ from colorama import Fore, Style
29
  # import openai
30
  import re
31
  # from termcolor import colored
32
- from colorama import colored
33
 
34
 
35
  para_tokenizer = AutoTokenizer.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base")
@@ -222,17 +222,21 @@ for i in combined_words_list[0]:
222
  # highlighted_sentences = []
223
 
224
 
 
 
 
 
225
  highlighted_sentence = main_sentence
226
  highlighted_text = []
227
 
228
  for substring in remove_overlapping(common_substrings):
229
- highlighted_sentence = highlighted_sentence.replace(substring, colored(substring, 'white', 'on_blue'))
230
- highlighted_text.append(colored(substring, 'white', 'on_blue'))
231
 
232
  st.markdown("Common substrings that occur in all five lists:")
233
 
234
  for substring in highlighted_text:
235
- st.write(substring, unsafe_allow_html=True)
236
 
237
  st.markdown("\nHighlighted Main Sentence:")
238
  st.write(highlighted_sentence, unsafe_allow_html=True)
 
29
  # import openai
30
  import re
31
  # from termcolor import colored
32
+ # from colorama import colored
33
 
34
 
35
  para_tokenizer = AutoTokenizer.from_pretrained("humarin/chatgpt_paraphraser_on_T5_base")
 
222
  # highlighted_sentences = []
223
 
224
 
225
+ import streamlit as st
226
+
227
+ # Assuming you have defined common_substrings and remove_overlapping functions
228
+
229
  highlighted_sentence = main_sentence
230
  highlighted_text = []
231
 
232
  for substring in remove_overlapping(common_substrings):
233
+ highlighted_sentence = highlighted_sentence.replace(substring, f'<span style="background-color: blue; color: white;">{substring}</span>')
234
+ highlighted_text.append(substring)
235
 
236
  st.markdown("Common substrings that occur in all five lists:")
237
 
238
  for substring in highlighted_text:
239
+ st.write(substring)
240
 
241
  st.markdown("\nHighlighted Main Sentence:")
242
  st.write(highlighted_sentence, unsafe_allow_html=True)