Update app.py
Browse files
app.py
CHANGED
@@ -359,28 +359,28 @@ def clean_text(text,doc=False,plain_text=False,url=False):
|
|
359 |
|
360 |
|
361 |
|
362 |
-
@st.
|
363 |
def get_spacy():
|
364 |
nlp = en_core_web_lg.load()
|
365 |
return nlp
|
366 |
|
367 |
-
@st.
|
368 |
def facebook_model():
|
369 |
|
370 |
summarizer = pipeline('summarization',model='facebook/bart-large-cnn')
|
371 |
return summarizer
|
372 |
|
373 |
-
@st.
|
374 |
def schleifer_model():
|
375 |
|
376 |
summarizer = pipeline('summarization',model='sshleifer/distilbart-cnn-12-6')
|
377 |
return summarizer
|
378 |
|
379 |
-
@st.
|
380 |
def get_sentence_embedding_model():
|
381 |
return SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|
382 |
|
383 |
-
@st.
|
384 |
def get_ner_pipeline():
|
385 |
tokenizer = AutoTokenizer.from_pretrained("xlm-roberta-large-finetuned-conll03-english")
|
386 |
model = AutoModelForTokenClassification.from_pretrained("xlm-roberta-large-finetuned-conll03-english")
|
@@ -431,16 +431,20 @@ st.markdown("---")
|
|
431 |
|
432 |
url_text = st.text_input("Please Enter a url here")
|
433 |
|
434 |
-
if url_text:
|
435 |
-
article_title, cleaned_text = clean_text(url_text, url=True)
|
436 |
-
|
437 |
article_text = st.text_area(
|
438 |
label='Full Article Text',
|
439 |
-
value=
|
440 |
placeholder="Full article text will be displayed here..",
|
441 |
-
height=250
|
|
|
442 |
)
|
443 |
|
|
|
|
|
|
|
|
|
|
|
|
|
444 |
st.markdown(
|
445 |
"<h3 style='text-align: center; color: red;'>OR</h3>",
|
446 |
unsafe_allow_html=True,
|
|
|
359 |
|
360 |
|
361 |
|
362 |
+
@st.cache
|
363 |
def get_spacy():
|
364 |
nlp = en_core_web_lg.load()
|
365 |
return nlp
|
366 |
|
367 |
+
@st.cache
|
368 |
def facebook_model():
|
369 |
|
370 |
summarizer = pipeline('summarization',model='facebook/bart-large-cnn')
|
371 |
return summarizer
|
372 |
|
373 |
+
@st.cache
|
374 |
def schleifer_model():
|
375 |
|
376 |
summarizer = pipeline('summarization',model='sshleifer/distilbart-cnn-12-6')
|
377 |
return summarizer
|
378 |
|
379 |
+
@st.cache
|
380 |
def get_sentence_embedding_model():
|
381 |
return SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|
382 |
|
383 |
+
@st.cache
|
384 |
def get_ner_pipeline():
|
385 |
tokenizer = AutoTokenizer.from_pretrained("xlm-roberta-large-finetuned-conll03-english")
|
386 |
model = AutoModelForTokenClassification.from_pretrained("xlm-roberta-large-finetuned-conll03-english")
|
|
|
431 |
|
432 |
url_text = st.text_input("Please Enter a url here")
|
433 |
|
|
|
|
|
|
|
434 |
article_text = st.text_area(
|
435 |
label='Full Article Text',
|
436 |
+
value= st.empty(),
|
437 |
placeholder="Full article text will be displayed here..",
|
438 |
+
height=250,
|
439 |
+
key='text_area'
|
440 |
)
|
441 |
|
442 |
+
if url_text:
|
443 |
+
article_title, cleaned_text = clean_text(url_text, url=True)
|
444 |
+
session_state.text_area = cleaned_text
|
445 |
+
|
446 |
+
|
447 |
+
|
448 |
st.markdown(
|
449 |
"<h3 style='text-align: center; color: red;'>OR</h3>",
|
450 |
unsafe_allow_html=True,
|