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