Update app.py
Browse files
app.py
CHANGED
@@ -73,11 +73,10 @@ def main():
|
|
73 |
+ This is a Natural Language Processing(NLP) Based App useful for basic NLP task
|
74 |
NER,Sentiment, Spell Corrections and Summarization
|
75 |
""")
|
|
|
76 |
# Entity Extraction
|
77 |
if st.checkbox("Show Named Entities"):
|
78 |
st.subheader("Analyze Your Text")
|
79 |
-
|
80 |
-
message = st.text_area("Enter your Text","Typing Here ..")
|
81 |
if st.button("Extract"):
|
82 |
entity_result = entity_analyzer(message)
|
83 |
st.json(entity_result)
|
@@ -85,7 +84,6 @@ def main():
|
|
85 |
# Sentiment Analysis
|
86 |
elif st.checkbox("Show Sentiment Analysis"):
|
87 |
st.subheader("Analyse Your Text")
|
88 |
-
message = st.text_area("Enter Text plz, Type Here ...")
|
89 |
if st.button("Analyze"):
|
90 |
blob = TextBlob(message)
|
91 |
result_sentiment = blob.sentiment
|
@@ -93,16 +91,14 @@ def main():
|
|
93 |
#Text Corrections
|
94 |
elif st.checkbox("Spell Corrections"):
|
95 |
st.subheader("Correct Your Text")
|
96 |
-
message = st.text_area("Enter the Text","Type please ..")
|
97 |
if st.button("Spell Corrections"):
|
98 |
st.text("Using TextBlob ..")
|
99 |
st.success(TextBlob(message).correct())
|
100 |
elif st.checkbox("Text Generation"):
|
101 |
st.subheader("Generate Text")
|
102 |
-
message = st.text_area("Enter the Text","Type please ..")
|
103 |
-
tokenizer, model = load_models()
|
104 |
-
input_ids = tokenizer(message, return_tensors='pt').input_ids
|
105 |
if st.button("Generate"):
|
|
|
|
|
106 |
st.text("Using Hugging Face Trnsformer, Contrastive Search ..")
|
107 |
output = model.generate(input_ids, max_length=128)
|
108 |
st.success(tokenizer.decode(output[0], skip_special_tokens=True))
|
|
|
73 |
+ This is a Natural Language Processing(NLP) Based App useful for basic NLP task
|
74 |
NER,Sentiment, Spell Corrections and Summarization
|
75 |
""")
|
76 |
+
message = st.text_area("Enter the Text","Type please ..")
|
77 |
# Entity Extraction
|
78 |
if st.checkbox("Show Named Entities"):
|
79 |
st.subheader("Analyze Your Text")
|
|
|
|
|
80 |
if st.button("Extract"):
|
81 |
entity_result = entity_analyzer(message)
|
82 |
st.json(entity_result)
|
|
|
84 |
# Sentiment Analysis
|
85 |
elif st.checkbox("Show Sentiment Analysis"):
|
86 |
st.subheader("Analyse Your Text")
|
|
|
87 |
if st.button("Analyze"):
|
88 |
blob = TextBlob(message)
|
89 |
result_sentiment = blob.sentiment
|
|
|
91 |
#Text Corrections
|
92 |
elif st.checkbox("Spell Corrections"):
|
93 |
st.subheader("Correct Your Text")
|
|
|
94 |
if st.button("Spell Corrections"):
|
95 |
st.text("Using TextBlob ..")
|
96 |
st.success(TextBlob(message).correct())
|
97 |
elif st.checkbox("Text Generation"):
|
98 |
st.subheader("Generate Text")
|
|
|
|
|
|
|
99 |
if st.button("Generate"):
|
100 |
+
tokenizer, model = load_models()
|
101 |
+
input_ids = tokenizer(message, return_tensors='pt').input_ids
|
102 |
st.text("Using Hugging Face Trnsformer, Contrastive Search ..")
|
103 |
output = model.generate(input_ids, max_length=128)
|
104 |
st.success(tokenizer.decode(output[0], skip_special_tokens=True))
|