| import gradio as gr | |
| import os | |
| from transformers import BertTokenizer, BertModel | |
| import torch | |
| tokenizer = BertTokenizer.from_pretrained('bert-base-uncased') | |
| def Bemenet(input_string): | |
| return tokenizer.tokenize("[CLS] " + input_string + " [SEP]") | |
| interface = gr.Interface(fn=Bemenet, | |
| title="Tokenizáló", | |
| description="Az itt megosztott példa mondatokat tokenizál. A bal oldali input mezőbe beírt mondat token-jei a jobb oldali szöveges mezőben jelennek meg.", | |
| inputs="text", | |
| outputs="text") | |
| interface.launch() |