Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
from datasets import load_dataset
|
4 |
+
|
5 |
+
ds = load_dataset("abisee/cnn_dailymail", "3.0.0")
|
6 |
+
t5_sum = pipeline("summarization", model= "t5-small")
|
7 |
+
|
8 |
+
# Set the title for the Streamlit app
|
9 |
+
st.title("T5 Summary Generator")
|
10 |
+
|
11 |
+
# Text input for the user
|
12 |
+
text = st.text_area("Enter your text: ")
|
13 |
+
|
14 |
+
def generate_summaries_and_context(dataset_sample):
|
15 |
+
article = dataset_sample
|
16 |
+
summary = summarizer(article, max_length=150, min_length=40, do_sample=False)
|
17 |
+
|
18 |
+
return summary[0]['summary_text']
|
19 |
+
|
20 |
+
if st.button("Generate"):
|
21 |
+
generated_text = generate_text(text)
|
22 |
+
if generated_text:
|
23 |
+
# Display the generated text
|
24 |
+
st.subheader("Generated Blog Post")
|
25 |
+
st.write(generated_text)
|
26 |
+
|