Spaces:
Runtime error
Runtime error
Signed-off-by: peter szemraj <[email protected]>
- app.py +3 -1
- summarize.py +3 -2
app.py
CHANGED
@@ -179,7 +179,9 @@ if __name__ == "__main__":
|
|
179 |
|
180 |
logging.info("Loading summ models")
|
181 |
model, tokenizer = load_model_and_tokenizer("pszemraj/pegasus-x-large-book-summary")
|
182 |
-
model_sm, tokenizer_sm = load_model_and_tokenizer(
|
|
|
|
|
183 |
|
184 |
logging.info("Loading OCR model")
|
185 |
with contextlib.redirect_stdout(None):
|
|
|
179 |
|
180 |
logging.info("Loading summ models")
|
181 |
model, tokenizer = load_model_and_tokenizer("pszemraj/pegasus-x-large-book-summary")
|
182 |
+
model_sm, tokenizer_sm = load_model_and_tokenizer(
|
183 |
+
"pszemraj/long-t5-tglobal-base-16384-book-summary"
|
184 |
+
)
|
185 |
|
186 |
logging.info("Loading OCR model")
|
187 |
with contextlib.redirect_stdout(None):
|
summarize.py
CHANGED
@@ -27,7 +27,9 @@ def load_model_and_tokenizer(model_name):
|
|
27 |
return model, tokenizer
|
28 |
|
29 |
|
30 |
-
def summarize_and_score(
|
|
|
|
|
31 |
"""
|
32 |
summarize_and_score - given a batch of ids and a mask, return a summary and a score for the summary
|
33 |
|
@@ -79,7 +81,6 @@ def summarize_and_score(ids, mask, model, tokenizer, is_general_attention_model=
|
|
79 |
return summary, score
|
80 |
|
81 |
|
82 |
-
|
83 |
def summarize_via_tokenbatches(
|
84 |
input_text: str,
|
85 |
model,
|
|
|
27 |
return model, tokenizer
|
28 |
|
29 |
|
30 |
+
def summarize_and_score(
|
31 |
+
ids, mask, model, tokenizer, is_general_attention_model=True, **kwargs
|
32 |
+
):
|
33 |
"""
|
34 |
summarize_and_score - given a batch of ids and a mask, return a summary and a score for the summary
|
35 |
|
|
|
81 |
return summary, score
|
82 |
|
83 |
|
|
|
84 |
def summarize_via_tokenbatches(
|
85 |
input_text: str,
|
86 |
model,
|