Purvesh Patel commited on
Commit
40da69e
1 Parent(s): 8f47ba0

initial file commit

Browse files
Files changed (2) hide show
  1. application.py +34 -0
  2. requirements.txt +4 -0
application.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+
3
+ ## Downlaod the PreTrained Model from the Online Repository
4
+ model = pipeline(
5
+ "text-classification",
6
+ model="badmatr11x/roberta-base-emotions-detection-from-text"
7
+ )
8
+
9
+
10
+ def app():
11
+ """This Function takes input from the user
12
+ and clssify it into different range of emotions.
13
+
14
+ Raises:
15
+ IOError: Raise an IOError if user input can't convert into the string instance.
16
+ """
17
+ # Get user input
18
+ try:
19
+ user_input = str(input("Enter Text Here: "))
20
+ except:
21
+ raise IOError("There is some problem reading text from the console.")
22
+
23
+ # Classify the text using the Huggingface model
24
+ if user_input:
25
+ result = model(user_input)
26
+ else:
27
+ print("No User Input is Provided.")
28
+
29
+ print(result)
30
+
31
+
32
+ if __name__ == "__main__":
33
+ ## Driver Function
34
+ app()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ datasets
2
+ transformers
3
+ scikit-learn
4
+ wandb