File size: 432 Bytes
7404c6d
f2b71e1
 
 
 
 
94d64b7
e0e00e7
94d64b7
e0e00e7
f2b71e1
e0e00e7
f2b71e1
e0e00e7
f2b71e1
e0e00e7
f2b71e1
e0e00e7
f2b71e1
e0e00e7
f2b71e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#Label 1 means relaxed and Label 0 means stressed
#To make custom predictions use the below code

# Use a pipeline as a high-level helper


from transformers import pipeline

pipe = pipeline("text-classification", model="sa-rehman/stress_classifier")

def predict(sentence):

    pred=pipe.predict(sentence)
    
    if pred[0].get("label")=='LABEL_1':
    
        return "relaxed"
        
    else:
    
        return "stressed"