Spaces:
Runtime error
Runtime error
File size: 780 Bytes
00fae30 c41c5d1 00fae30 c41c5d1 00fae30 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import gradio as gr
import emoji
from simpletransformers.classification import ClassificationModel, ClassificationArgs
CLASS_NAMES = ['angry_face', 'crying_face', 'face_with_crossed-out_eyes', 'face_with_open_mouth', 'flushed_face', 'grinning_face_with_smiling_eyes', 'loudly_crying_face', 'pouting_face', 'slightly_smiling_face', 'smiling_face_with_smiling_eyes', 'sparkles', 'tired_face']
model_args = ClassificationArgs()
model_original = ClassificationModel(
'auto',
'xiongjie/face-expression-ja',
use_cuda=True,
args=model_args,
num_labels=len(emoticon_dataset.CLASS_NAMES)
)
def predict_emoticon(text):
return emoji.emojize(":" + model_onnx.predict([text])[0][0] + ":")
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch() |