siddhantuniyal commited on
Commit
bce414a
1 Parent(s): 6274abb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -30,15 +30,15 @@ def sentiment_analysis(input_text):
30
 
31
  if score['neg']>score['pos']:
32
 
33
- return "Negative Feedback"
34
 
35
  elif score['neg']<score['pos']:
36
 
37
- return "Positive Feedback"
38
 
39
  else:
40
 
41
- return "Neutral Feedback"
42
 
43
  def positive_zero_shot(input_text):
44
 
@@ -55,21 +55,21 @@ def pipeline(input_text):
55
 
56
  if spam_detection(input_text):
57
 
58
- if sentiment_analysis(input_text) == "Positive Feedback":
59
 
60
- return "Positive Feedback" , positive_zero_shot(input_text)
61
 
62
- elif sentiment_analysis(input_text) == "Negative Feedback":
63
 
64
- return "Negative Feedback" , negative_zero_shot(input_text)
65
 
66
  else:
67
 
68
- return "Neutral Feedback" , ""
69
  else:
70
  return "Spam" , ""
71
 
72
- iface = gr.Interface(fn = pipeline , inputs=['text'] , outputs=['text' , 'text'])
73
  iface.launch(share=True)
74
 
75
 
 
30
 
31
  if score['neg']>score['pos']:
32
 
33
+ return ["Negative Feedback" , score['neg']]
34
 
35
  elif score['neg']<score['pos']:
36
 
37
+ return ["Positive Feedback" , -1]
38
 
39
  else:
40
 
41
+ return ["Neutral Feedback" , -1]
42
 
43
  def positive_zero_shot(input_text):
44
 
 
55
 
56
  if spam_detection(input_text):
57
 
58
+ if sentiment_analysis(input_text)[0] == "Positive Feedback":
59
 
60
+ return "Positive Feedback" , -1 , positive_zero_shot(input_text)
61
 
62
+ elif sentiment_analysis(input_text)[0] == "Negative Feedback":
63
 
64
+ return "Negative Feedback" , sentiment_analysis(input_text)[1] , negative_zero_shot(input_text)
65
 
66
  else:
67
 
68
+ return "Neutral Feedback" , -1 , ""
69
  else:
70
  return "Spam" , ""
71
 
72
+ iface = gr.Interface(fn = pipeline , inputs=['text'] , outputs=['text' , 'text' , 'text'])
73
  iface.launch(share=True)
74
 
75