Spaces:
Runtime error
Runtime error
cache abs summarizer
Browse files
app.py
CHANGED
@@ -10,12 +10,13 @@ from src.abstractive_summarizer import (
|
|
10 |
preprocess_text_for_abstractive_summarization,
|
11 |
)
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
19 |
|
20 |
|
21 |
if __name__ == "__main__":
|
@@ -73,8 +74,11 @@ if __name__ == "__main__":
|
|
73 |
text="Creating abstractive summary. This might take a few seconds ..."
|
74 |
):
|
75 |
text_to_summarize = clean_txt
|
76 |
-
abs_summarizer = pipeline(
|
77 |
-
|
|
|
|
|
|
|
78 |
)
|
79 |
if is_url is False:
|
80 |
# list of chunks
|
|
|
10 |
preprocess_text_for_abstractive_summarization,
|
11 |
)
|
12 |
|
13 |
+
|
14 |
+
@st.cache()
|
15 |
+
def load_abs_summarizer(model_name, tokenizer_name):
|
16 |
+
abs_summarizer = pipeline(
|
17 |
+
"summarization", model=model_name, tokenizer=tokenizer_name
|
18 |
+
)
|
19 |
+
return abs_summarizer
|
20 |
|
21 |
|
22 |
if __name__ == "__main__":
|
|
|
74 |
text="Creating abstractive summary. This might take a few seconds ..."
|
75 |
):
|
76 |
text_to_summarize = clean_txt
|
77 |
+
# abs_summarizer = pipeline(
|
78 |
+
# "summarization", model=abs_model_name, tokenizer=abs_tokenizer_name
|
79 |
+
# )
|
80 |
+
abs_summarizer = load_abs_summarizer(
|
81 |
+
model_name=abs_model_name, tokenizer_name=abs_tokenizer_name
|
82 |
)
|
83 |
if is_url is False:
|
84 |
# list of chunks
|