Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,20 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import emoji
|
| 3 |
+
from simpletransformers.classification import ClassificationModel, ClassificationArgs
|
| 4 |
|
| 5 |
+
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']
|
| 6 |
+
|
| 7 |
+
model_args = ClassificationArgs()
|
| 8 |
+
model_original = ClassificationModel(
|
| 9 |
+
'auto',
|
| 10 |
+
'xiongjie/face-expression-ja',
|
| 11 |
+
use_cuda=True,
|
| 12 |
+
args=model_args,
|
| 13 |
+
num_labels=len(emoticon_dataset.CLASS_NAMES)
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
def predict_emoticon(text):
|
| 17 |
+
return emoji.emojize(":" + model_onnx.predict([text])[0][0] + ":")
|
| 18 |
|
| 19 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 20 |
iface.launch()
|