saritha5 commited on
Commit
daf16cc
1 Parent(s): 29e26e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -25,26 +25,26 @@ config = AutoConfig.from_pretrained(MODEL)
25
 
26
  # create classifier function
27
  def classify_compliant(text):
28
- if len(text)==0:
29
- return "Cannot Categorize the complaint"
30
- else:
31
  text = cleaned_complaints(text)
32
- text = preprocess(text)
33
- encoded_input = tokenizer(text, return_tensors='pt')
34
- output = model(**encoded_input)
35
- scores = output[0][0].detach().numpy()
36
- scores = softmax(scores)
 
 
 
37
 
38
- # Print labels and scores
39
- probs = {}
40
- ranking = np.argsort(scores)
41
- ranking = ranking[::-1]
42
 
43
 
44
- l = config.id2label[ranking[0]]
45
  #s = scores[ranking[i]]
46
  #probs[l] = np.round(float(s), 4)
47
- return l
48
 
49
 
50
  #build the Gradio app
 
25
 
26
  # create classifier function
27
  def classify_compliant(text):
 
 
 
28
  text = cleaned_complaints(text)
29
+ if len(text)==0:
30
+ return "Cannot Categorize the Complaint"
31
+ else:
32
+ text = preprocess(text)
33
+ encoded_input = tokenizer(text, return_tensors='pt')
34
+ output = model(**encoded_input)
35
+ scores = output[0][0].detach().numpy()
36
+ scores = softmax(scores)
37
 
38
+ # Print labels and scores
39
+ probs = {}
40
+ ranking = np.argsort(scores)
41
+ ranking = ranking[::-1]
42
 
43
 
44
+ l = config.id2label[ranking[0]]
45
  #s = scores[ranking[i]]
46
  #probs[l] = np.round(float(s), 4)
47
+ return l
48
 
49
 
50
  #build the Gradio app