Update app.py
Browse files
app.py
CHANGED
@@ -107,13 +107,12 @@ def main():
|
|
107 |
st.success(TextBlob(text).correct())
|
108 |
if st.checkbox("Text Generation"):
|
109 |
ok = st.button("Generate")
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
# Summarization
|
117 |
if st.checkbox("Mark here, Text Summarization for English or Bangla!"):
|
118 |
#st.subheader("Summarize Your Text for English and Bangla Texts!")
|
119 |
#message = st.text_area("Enter the Text","Type please ..")
|
@@ -133,7 +132,7 @@ def main():
|
|
133 |
summary_ids = model.generate(inputs, max_length=150, min_length=80, length_penalty=5., num_beams=2)
|
134 |
summary = tokenizer.decode(summary_ids[0])
|
135 |
st.success(summary)
|
136 |
-
|
137 |
|
138 |
st.sidebar.subheader("About App")
|
139 |
st.sidebar.subheader("By")
|
|
|
107 |
st.success(TextBlob(text).correct())
|
108 |
if st.checkbox("Text Generation"):
|
109 |
ok = st.button("Generate")
|
110 |
+
tokenizer, model = load_models()
|
111 |
+
if ok:
|
112 |
+
input_ids = tokenizer(text, return_tensors='pt').input_ids
|
113 |
+
st.text("Using Hugging Face Transformer, Contrastive Search ..")
|
114 |
+
output = model.generate(input_ids, max_length=128)
|
115 |
+
st.success(tokenizer.decode(output[0], skip_special_tokens=True))
|
|
|
116 |
if st.checkbox("Mark here, Text Summarization for English or Bangla!"):
|
117 |
#st.subheader("Summarize Your Text for English and Bangla Texts!")
|
118 |
#message = st.text_area("Enter the Text","Type please ..")
|
|
|
132 |
summary_ids = model.generate(inputs, max_length=150, min_length=80, length_penalty=5., num_beams=2)
|
133 |
summary = tokenizer.decode(summary_ids[0])
|
134 |
st.success(summary)
|
135 |
+
st.experimental_rerun()
|
136 |
|
137 |
st.sidebar.subheader("About App")
|
138 |
st.sidebar.subheader("By")
|