File size: 784 Bytes
b11881c
6742665
b11881c
d4d234d
6742665
 
 
 
 
 
2afa359
 
 
 
 
 
bb84a6a
 
6742665
bb84a6a
37ae60f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from xlm_emo.classifier import  EmotionClassifier

io1 = 'huggingface/MilaNLProc/xlm-emo-t'

def emotionClassifier(text):
  ec = EmotionClassifier()
  translation = ec.predict([text])
  res=translation[0]
  return res 
  
'''
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("MilaNLProc/xlm-emo-t")
model = AutoModelForSequenceClassification.from_pretrained("MilaNLProc/xlm-emo-t")    
'''  
inputs = gr.inputs.Textbox(label="Text")
outpts=gr.outputs.Textbox(label="Output")
  
#gr.Interface(emotionClassifier, inputs=inputs,outputs=outpts, title='Emotions Analyser',theme='peach').launch()
gr.Interface.load(io1, inputs=inputs, title="Emotions Analyser",theme='peach').launch(enable_queue=True)