Spaces:
Runtime error
Runtime error
Commit
Β·
fa55da5
1
Parent(s):
0a416ac
Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,9 @@ model_path = "leadingbridge/summarization"
|
|
12 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
13 |
model = T5ForConditionalGeneration.from_pretrained(model_path)
|
14 |
text = "This is the initial testing text"
|
|
|
|
|
|
|
15 |
def summarize_text(text):
|
16 |
# Tokenize the input text
|
17 |
inputs = tokenizer.encode(text, return_tensors="pt")
|
|
|
12 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
13 |
model = T5ForConditionalGeneration.from_pretrained(model_path)
|
14 |
text = "This is the initial testing text"
|
15 |
+
inputs = tokenizer.encode(text, return_tensors="pt")
|
16 |
+
summary_ids = model.generate(inputs)
|
17 |
+
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
18 |
def summarize_text(text):
|
19 |
# Tokenize the input text
|
20 |
inputs = tokenizer.encode(text, return_tensors="pt")
|