File size: 412 Bytes
5a3ebe3
0bdb91f
33011f2
5a3ebe3
0bdb91f
d3d9869
92610d2
5a3ebe3
 
1
2
3
4
5
6
7
8
9
import gradio as gr
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("liam168/c2-roberta-base-finetuned-dianping-chinese")
def greet(name):
    result = tokenizer([name],padding=True,truncation=True,return_tensors="pt")
    tensor_str = ','.join(map(str, result.input_ids.numpy()))
    return tensor_str
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()