Update README.md
Browse files
README.md
CHANGED
|
@@ -3,5 +3,24 @@ library_name: generic
|
|
| 3 |
tags:
|
| 4 |
- summarization
|
| 5 |
---
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
- summarization
|
| 5 |
---
|
| 6 |
+
|
| 7 |
+
### Interface
|
| 8 |
+
import requests
|
| 9 |
+
|
| 10 |
+
API_URL = "https://api-inference.huggingface.co/models/Lin0He/text-summary-gpt2-short"
|
| 11 |
+
headers = {"Authorization": "Bearer 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"}
|
| 12 |
+
|
| 13 |
+
def query(payload):
|
| 14 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
| 15 |
+
return response.json()
|
| 16 |
+
|
| 17 |
+
output = query({
|
| 18 |
+
"inputs": "Today was a beautiful day. I have down all my homework, and baked some cookies with my friends. What a lovely day."
|
| 19 |
+
})
|
| 20 |
+
print(output)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|