Spaces:
Running
Running
feat: increase response length
Browse files
app.py
CHANGED
@@ -3,12 +3,11 @@ from transformers import pipeline
|
|
3 |
st.set_page_config(page_title="Text Summarisation", page_icon="🤖", layout="wide", initial_sidebar_state="expanded",)
|
4 |
st.title("Text Summarisation")
|
5 |
pipe = pipeline(task="summarization", model="facebook/bart-large-cnn")
|
6 |
-
|
7 |
|
8 |
if text:
|
9 |
-
out = pipe(
|
10 |
-
st.write(out)
|
11 |
-
st.write(f"{type(out)}, length: {len(out)}")
|
12 |
|
13 |
if len(out) >= 1:
|
|
|
14 |
st.download_button("summary download", out[0]['summary_text'], file_name="summersation.txt", mime="text/plain")
|
|
|
3 |
st.set_page_config(page_title="Text Summarisation", page_icon="🤖", layout="wide", initial_sidebar_state="expanded",)
|
4 |
st.title("Text Summarisation")
|
5 |
pipe = pipeline(task="summarization", model="facebook/bart-large-cnn")
|
6 |
+
text_value = st.text_area("Summarise the following")
|
7 |
|
8 |
if text:
|
9 |
+
out = pipe(text_value, max_length=int(len(text_value)/2), min_length=int(len(text_value)/3), do_sample=False)
|
|
|
|
|
10 |
|
11 |
if len(out) >= 1:
|
12 |
+
st.write(out[0]['summary_text'])
|
13 |
st.download_button("summary download", out[0]['summary_text'], file_name="summersation.txt", mime="text/plain")
|