Commit
·
10dd203
1
Parent(s):
d13e88c
Update README.md
Browse files
README.md
CHANGED
|
@@ -26,16 +26,16 @@ tokenizer = BertTokenizer.from_pretrained("bert-base-german-cased")
|
|
| 26 |
Prepare Your Text:
|
| 27 |
You can perform text classification with this model. Tokenize your text using the tokenizer:
|
| 28 |
|
| 29 |
-
|
| 30 |
text = "Deine Textnachricht hier" # Your German text
|
| 31 |
-
|
| 32 |
Get Predictions:
|
| 33 |
Predict the label or class for your text:
|
|
|
|
| 34 |
|
| 35 |
-
|
| 36 |
-
with tf.device('/GPU:0'):
|
| 37 |
outputs = model(inputs)
|
| 38 |
-
predicted_class = tf.argmax(outputs.logits, axis=1).numpy()[0]
|
| 39 |
The predicted_class will give you the predicted label for your text.
|
| 40 |
|
| 41 |
Semantic Search:
|
|
|
|
| 26 |
Prepare Your Text:
|
| 27 |
You can perform text classification with this model. Tokenize your text using the tokenizer:
|
| 28 |
|
| 29 |
+
# Enter Text Input
|
| 30 |
text = "Deine Textnachricht hier" # Your German text
|
| 31 |
+
|
| 32 |
Get Predictions:
|
| 33 |
Predict the label or class for your text:
|
| 34 |
+
inputs = tokenizer(text, padding='max_length', truncation=True, max_length=128, return_tensors='tf', return_attention_mask=True)
|
| 35 |
|
| 36 |
+
# Make a prediction
|
| 37 |
+
with tf.device('/GPU:0'): # Specify the GPU device
|
| 38 |
outputs = model(inputs)
|
|
|
|
| 39 |
The predicted_class will give you the predicted label for your text.
|
| 40 |
|
| 41 |
Semantic Search:
|