segestic commited on
Commit
46fbde0
·
1 Parent(s): ab5b1bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -74,20 +74,20 @@ import streamlit as st
74
  #from .paraphraser import get_paraphrased_sentences, model, tokenizer
75
 
76
  #######
77
- from sentence_splitter import SentenceSplitter, split_text_into_sentences
78
 
79
- splitter = SentenceSplitter(language='en')
80
 
81
- def clean(text):
82
- sentence_list = splitter.split(text)
83
- paraphrase = []
84
 
85
- for i in sentence_list:
86
- paraphrase.append(i)
87
- paraphrase2 = [' '.join(x) for x in paraphrase]
88
- paraphrase3 = [' '.join(x for x in paraphrase2) ]
89
- paraphrased_text = str(paraphrase3).strip('[]').strip("'")
90
- return paraphrased_text
91
 
92
 
93
  def app():
@@ -103,7 +103,7 @@ def app():
103
  paraphraseNo = st.slider('Number of Parapharases',1,10,2)
104
  if st.button('Paraphrase'):
105
  with st.spinner(text="This may take a moment..."):
106
- output = get_paraphrased_sentences(model, tokenizer, clean(user_input), num_beams=10, num_return_sequences=paraphraseNo)
107
 
108
  #with spacer:
109
 
 
74
  #from .paraphraser import get_paraphrased_sentences, model, tokenizer
75
 
76
  #######
77
+ # from sentence_splitter import SentenceSplitter, split_text_into_sentences
78
 
79
+ # splitter = SentenceSplitter(language='en')
80
 
81
+ # def clean(text):
82
+ # sentence_list = splitter.split(text)
83
+ # paraphrase = []
84
 
85
+ # for i in sentence_list:
86
+ # paraphrase.append(i)
87
+ # paraphrase2 = [' '.join(x) for x in paraphrase]
88
+ # paraphrase3 = [' '.join(x for x in paraphrase2) ]
89
+ # paraphrased_text = str(paraphrase3).strip('[]').strip("'")
90
+ # return paraphrased_text
91
 
92
 
93
  def app():
 
103
  paraphraseNo = st.slider('Number of Parapharases',1,10,2)
104
  if st.button('Paraphrase'):
105
  with st.spinner(text="This may take a moment..."):
106
+ output = get_paraphrased_sentences(model, tokenizer, user_input, num_beams=10, num_return_sequences=paraphraseNo)
107
 
108
  #with spacer:
109