Spaces:
Runtime error
Runtime error
File size: 598 Bytes
59b85d3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from transformers import pipeline
def bert_summarization(inputs):
# import requests
# API_URL = (
# "https://api-inference.huggingface.co/models/philschmid/bart-large-cnn-samsum"
# )
# headers = {"Authorization": "Bearer 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"}
# def query(payload):
# response = requests.post(API_URL, headers=headers, json=payload)
# return response.json()
# return query({"inputs": inputs})
summarizer = pipeline("summarization", model="philschmid/bart-large-cnn-samsum")
return summarizer(inputs)[0]["summary_text"]
|