File size: 478 Bytes
3e99450
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
import requests
import gradio as gr
API_URL = "https://api-inference.huggingface.co/models/philschmid/bart-large-cnn-samsum"
headers = {"Authorization": "Bearer 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","Content-Type": "application/json" }
def query(请输入你要总结的文章内容):
    response = requests.post(API_URL, headers=headers, json=payload)
    output=response.json()
    return output[0]['summary_text']
gr.Interface(query, inputs="text", outputs="text").launch()