Soumen commited on
Commit
7c455a4
·
1 Parent(s): f4a3daa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -42,7 +42,7 @@ import pdf2image
42
  # NLP Pkgs
43
  from textblob import TextBlob
44
  import spacy
45
- from gensim.summarization import summarize
46
  import requests
47
  import cv2
48
  import numpy as np
@@ -173,20 +173,20 @@ def main():
173
  if st.checkbox("Spell Corrections for English"):
174
  st.success(TextBlob(text).correct())
175
  if st.checkbox("Text Generation"):
176
- ok = st.button("Generate")
177
- if ok:
178
- tokenizer, model = load_models()
179
- input_ids = tokenizer(text, return_tensors='pt').input_ids
180
- st.text("Using Hugging Face Transformer, Contrastive Search ..")
181
- output = model.generate(input_ids, max_length=128)
182
- st.success(tokenizer.decode(output[0], skip_special_tokens=True))
183
- if st.checkbox("Mark here, Text Summarization for English or Bangla!"):
184
  #st.subheader("Summarize Your Text for English and Bangla Texts!")
185
  #message = st.text_area("Enter the Text","Type please ..")
186
  #st.text("Using Gensim Summarizer ..")
187
  #st.success(mess)
188
- summary_result = summarize(text)
189
- st.success(summary_result)
190
  if st.checkbox("Mark to better English Text Summarization!"):
191
  #st.title("Summarize Your Text for English only!")
192
  tokenizer = AutoTokenizer.from_pretrained('t5-base')
 
42
  # NLP Pkgs
43
  from textblob import TextBlob
44
  import spacy
45
+ #from gensim.summarization import summarize
46
  import requests
47
  import cv2
48
  import numpy as np
 
173
  if st.checkbox("Spell Corrections for English"):
174
  st.success(TextBlob(text).correct())
175
  if st.checkbox("Text Generation"):
176
+ #ok = st.button("Generate")
177
+ #if ok:
178
+ tokenizer, model = load_models()
179
+ input_ids = tokenizer(text, return_tensors='pt').input_ids
180
+ st.text("Using Hugging Face Transformer, Contrastive Search ..")
181
+ output = model.generate(input_ids, max_length=128)
182
+ st.success(tokenizer.decode(output[0], skip_special_tokens=True))
183
+ #if st.checkbox("Mark here, Text Summarization for English or Bangla!"):
184
  #st.subheader("Summarize Your Text for English and Bangla Texts!")
185
  #message = st.text_area("Enter the Text","Type please ..")
186
  #st.text("Using Gensim Summarizer ..")
187
  #st.success(mess)
188
+ #summary_result = summarize(text)
189
+ #st.success(summary_result)
190
  if st.checkbox("Mark to better English Text Summarization!"):
191
  #st.title("Summarize Your Text for English only!")
192
  tokenizer = AutoTokenizer.from_pretrained('t5-base')