Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,10 +19,7 @@ def read_pdf(pdf):
|
|
19 |
return text
|
20 |
|
21 |
|
22 |
-
def summarizer(
|
23 |
-
# model = T5ForConditionalGeneration.from_pretrained("t5-base")
|
24 |
-
# tokenizer = T5TokenizerFast.from_pretrained("t5-base")
|
25 |
-
text=read_pdf(pdf)
|
26 |
inputs = tokenizer.encode("summarize: " + text,return_tensors="pt", max_length=1000,truncation=True)
|
27 |
outputs = model.generate(inputs,max_length=1000, min_length=100,length_penalty=2.0, num_beams=4,early_stopping=True)
|
28 |
summary = tokenizer.decode(outputs[0])
|
|
|
19 |
return text
|
20 |
|
21 |
|
22 |
+
def summarizer(text):
|
|
|
|
|
|
|
23 |
inputs = tokenizer.encode("summarize: " + text,return_tensors="pt", max_length=1000,truncation=True)
|
24 |
outputs = model.generate(inputs,max_length=1000, min_length=100,length_penalty=2.0, num_beams=4,early_stopping=True)
|
25 |
summary = tokenizer.decode(outputs[0])
|