Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Load the summarization pipeline
|
5 |
-
summarizer = pipeline("summarization")
|
6 |
|
7 |
def summarize_text(text):
|
8 |
-
"""Summarize the input text using
|
9 |
summary = summarizer(text, max_length=150, min_length=50, do_sample=False)
|
10 |
return summary[0]['summary_text']
|
11 |
|
12 |
# Streamlit UI
|
13 |
-
st.title("Text Summarization with
|
14 |
|
15 |
st.write("Enter the text you want to summarize:")
|
16 |
|
@@ -25,4 +25,3 @@ if st.button("Summarize"):
|
|
25 |
st.write(summary)
|
26 |
else:
|
27 |
st.error("Please enter some text to summarize.")
|
28 |
-
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Load the T5 summarization pipeline
|
5 |
+
summarizer = pipeline("summarization", model="t5-small", tokenizer="t5-small")
|
6 |
|
7 |
def summarize_text(text):
|
8 |
+
"""Summarize the input text using the T5 model."""
|
9 |
summary = summarizer(text, max_length=150, min_length=50, do_sample=False)
|
10 |
return summary[0]['summary_text']
|
11 |
|
12 |
# Streamlit UI
|
13 |
+
st.title("Text Summarization with T5")
|
14 |
|
15 |
st.write("Enter the text you want to summarize:")
|
16 |
|
|
|
25 |
st.write(summary)
|
26 |
else:
|
27 |
st.error("Please enter some text to summarize.")
|
|