testsummarize / app.py
zjrwtx's picture
Create app.py
3e99450
raw history blame
No virus
478 Bytes
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()