Update README.md
Browse files
README.md
CHANGED
|
@@ -27,7 +27,22 @@ This model can be directly used to correct grammar and spelling mistakes in sent
|
|
| 27 |
### Example Usage
|
| 28 |
|
| 29 |
Here's a basic code snippet to demonstrate how to use the model:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
|
|
|
| 31 |
```python
|
| 32 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
| 33 |
|
|
|
|
| 27 |
### Example Usage
|
| 28 |
|
| 29 |
Here's a basic code snippet to demonstrate how to use the model:
|
| 30 |
+
```python
|
| 31 |
+
import requests
|
| 32 |
+
|
| 33 |
+
API_URL = "https://api-inference.huggingface.co/models/samadpls/t5-base-grammar-checker"
|
| 34 |
+
HEADERS = {"Authorization": "Bearer YOUR_HF_API_KEY"}
|
| 35 |
+
|
| 36 |
+
def query(payload):
|
| 37 |
+
response = requests.post(API_URL, headers=HEADERS, json=payload)
|
| 38 |
+
return response.json()
|
| 39 |
+
|
| 40 |
+
data = query({"inputs": "grammar: This sentences, has bads grammar and spelling!"})
|
| 41 |
+
print(data)
|
| 42 |
+
|
| 43 |
+
```
|
| 44 |
|
| 45 |
+
OR
|
| 46 |
```python
|
| 47 |
from transformers import T5ForConditionalGeneration, T5Tokenizer
|
| 48 |
|