Update README.md
Browse files
README.md
CHANGED
@@ -3,4 +3,23 @@ license: apache-2.0
|
|
3 |
language:
|
4 |
- en
|
5 |
library_name: transformers
|
6 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
language:
|
4 |
- en
|
5 |
library_name: transformers
|
6 |
+
---
|
7 |
+
# Model Name
|
8 |
+
|
9 |
+
This is a chatbot model trained using a transformer architecture. It can answer questions based on the training data provided.
|
10 |
+
|
11 |
+
## Usage
|
12 |
+
|
13 |
+
```python
|
14 |
+
from transformers import AutoTokenizer, TFAutoModelForSeq2SeqLM
|
15 |
+
|
16 |
+
tokenizer = AutoTokenizer.from_pretrained("your_username/your_model_name")
|
17 |
+
model = TFAutoModelForSeq2SeqLM.from_pretrained("your_username/your_model_name")
|
18 |
+
|
19 |
+
def predict(sentence):
|
20 |
+
inputs = tokenizer(sentence, return_tensors="tf")
|
21 |
+
outputs = model.generate(inputs["input_ids"])
|
22 |
+
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
23 |
+
|
24 |
+
sentence = "Can exposure to pesticides in food impact cognitive health?"
|
25 |
+
print(predict(sentence))
|