Spaces:
Sleeping
Sleeping
EmreYY20
commited on
Commit
·
ccd2173
1
Parent(s):
cce90fc
add abstractive model
Browse files- abstractive_model.py +6 -0
- app.py +3 -3
- requirements.txt +0 -0
abstractive_model.py
CHANGED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
|
3 |
+
def summarize_with_bart(text):
|
4 |
+
pipe = pipeline("text2text-generation", model="EE21/Fine-tuned-BART-ToS-Summarization")
|
5 |
+
summary = pipe(text, max_length=130, min_length=30, do_sample=False)[0]['generated_text']
|
6 |
+
return summary
|
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import PyPDF2
|
3 |
from extractive_model import summarize_with_textrank
|
|
|
4 |
#from blanc import BlancHelp
|
5 |
|
6 |
# Set page to wide mode
|
@@ -51,9 +52,8 @@ def main():
|
|
51 |
|
52 |
# Perform extractive summarization
|
53 |
if radio_selection == "Abstractive":
|
54 |
-
|
55 |
-
|
56 |
-
#st.session_state.summary = summary
|
57 |
|
58 |
# Right column: Displaying text after pressing 'Summarize'
|
59 |
with col3:
|
|
|
1 |
import streamlit as st
|
2 |
import PyPDF2
|
3 |
from extractive_model import summarize_with_textrank
|
4 |
+
from abstractive_model import summarize_with_bart
|
5 |
#from blanc import BlancHelp
|
6 |
|
7 |
# Set page to wide mode
|
|
|
52 |
|
53 |
# Perform extractive summarization
|
54 |
if radio_selection == "Abstractive":
|
55 |
+
summary = summarize_with_bart(file_content)
|
56 |
+
st.session_state.summary = summary
|
|
|
57 |
|
58 |
# Right column: Displaying text after pressing 'Summarize'
|
59 |
with col3:
|
requirements.txt
CHANGED
Binary files a/requirements.txt and b/requirements.txt differ
|
|