Update app.py
Browse files
app.py
CHANGED
@@ -70,27 +70,6 @@ def main():
|
|
70 |
This is a Natural Language Processing(NLP) Based Application useful for basic NLP tasks
|
71 |
Named Entity Recognition, Sentiment Analysis, Spell Corrections, Human Level Text Generation, and Summarization
|
72 |
""")
|
73 |
-
# Entity Extraction
|
74 |
-
text = st.text_input("Type your text!")
|
75 |
-
if st.checkbox("Show Named Entities"):
|
76 |
-
entity_result = entity_analyzer(text)
|
77 |
-
st.json(entity_result)
|
78 |
-
# Sentiment Analysis
|
79 |
-
if st.checkbox("Show Sentiment Analysis"):
|
80 |
-
blob = TextBlob(text)
|
81 |
-
result_sentiment = blob.sentiment
|
82 |
-
st.success(result_sentiment)
|
83 |
-
#Text Corrections
|
84 |
-
if st.checkbox("Spell Corrections"):
|
85 |
-
st.success(TextBlob(text).correct())
|
86 |
-
if st.checkbox("Text Generation"):
|
87 |
-
ok = st.button("Generate")
|
88 |
-
tokenizer, model = load_models()
|
89 |
-
if ok:
|
90 |
-
input_ids = tokenizer(text, return_tensors='pt').input_ids
|
91 |
-
st.text("Using Hugging Face Transformer, Contrastive Search ..")
|
92 |
-
output = model.generate(input_ids, max_length=128)
|
93 |
-
st.success(tokenizer.decode(output[0], skip_special_tokens=True))
|
94 |
def change_photo_state():
|
95 |
st.session_state["photo"]="done"
|
96 |
st.subheader("Summary section, feed your image!")
|
@@ -117,6 +96,25 @@ def main():
|
|
117 |
#our_image=load_image("image.jpg")
|
118 |
#img = cv2.imread("scholarly_text.jpg")
|
119 |
text = message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
# Summarization
|
121 |
if st.checkbox("Mark here, Text Summarization for English or Bangla!"):
|
122 |
#st.subheader("Summarize Your Text for English and Bangla Texts!")
|
|
|
70 |
This is a Natural Language Processing(NLP) Based Application useful for basic NLP tasks
|
71 |
Named Entity Recognition, Sentiment Analysis, Spell Corrections, Human Level Text Generation, and Summarization
|
72 |
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
def change_photo_state():
|
74 |
st.session_state["photo"]="done"
|
75 |
st.subheader("Summary section, feed your image!")
|
|
|
96 |
#our_image=load_image("image.jpg")
|
97 |
#img = cv2.imread("scholarly_text.jpg")
|
98 |
text = message
|
99 |
+
if st.checkbox("Show Named Entities"):
|
100 |
+
entity_result = entity_analyzer(text)
|
101 |
+
st.json(entity_result)
|
102 |
+
# Sentiment Analysis
|
103 |
+
if st.checkbox("Show Sentiment Analysis"):
|
104 |
+
blob = TextBlob(text)
|
105 |
+
result_sentiment = blob.sentiment
|
106 |
+
st.success(result_sentiment)
|
107 |
+
#Text Corrections
|
108 |
+
if st.checkbox("Spell Corrections"):
|
109 |
+
st.success(TextBlob(text).correct())
|
110 |
+
if st.checkbox("Text Generation"):
|
111 |
+
ok = st.button("Generate")
|
112 |
+
tokenizer, model = load_models()
|
113 |
+
if ok:
|
114 |
+
input_ids = tokenizer(text, return_tensors='pt').input_ids
|
115 |
+
st.text("Using Hugging Face Transformer, Contrastive Search ..")
|
116 |
+
output = model.generate(input_ids, max_length=128)
|
117 |
+
st.success(tokenizer.decode(output[0], skip_special_tokens=True))
|
118 |
# Summarization
|
119 |
if st.checkbox("Mark here, Text Summarization for English or Bangla!"):
|
120 |
#st.subheader("Summarize Your Text for English and Bangla Texts!")
|