Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,22 @@
|
|
1 |
-
|
2 |
-
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
|
|
|
4 |
tokenizer = AutoTokenizer.from_pretrained("Chillyblast/Bart_Summarization")
|
5 |
model = AutoModelForSeq2SeqLM.from_pretrained("Chillyblast/Bart_Summarization")
|
6 |
|
7 |
-
from transformers import pipeline
|
8 |
-
|
9 |
# Create a pipeline for text summarization
|
10 |
summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
|
11 |
|
12 |
-
#
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
16 |
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
3 |
|
4 |
+
# Load model and tokenizer
|
5 |
tokenizer = AutoTokenizer.from_pretrained("Chillyblast/Bart_Summarization")
|
6 |
model = AutoModelForSeq2SeqLM.from_pretrained("Chillyblast/Bart_Summarization")
|
7 |
|
|
|
|
|
8 |
# Create a pipeline for text summarization
|
9 |
summarizer = pipeline("summarization", model=model, tokenizer=tokenizer)
|
10 |
|
11 |
+
# Streamlit app
|
12 |
+
st.title("Text Summarization App")
|
13 |
+
|
14 |
+
# Create a text input box for user input
|
15 |
+
dialogue = st.text_area("Enter the input:")
|
16 |
|
17 |
+
if dialogue:
|
18 |
+
# Perform inference
|
19 |
+
summary = summarizer(dialogue, max_length=500, min_length=300, do_sample=False)
|
20 |
+
|
21 |
+
# Display the summary
|
22 |
+
st.write("Summary:", summary[0]['summary_text'])
|