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"]