ReiderMx commited on
Commit
b770003
1 Parent(s): 198f981

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -7,7 +7,11 @@ def load_model(selected_model):
7
  loaded_model = pickle.load(file)
8
  return loaded_model
9
 
10
-
 
 
 
 
11
 
12
  classifier = pipeline(task="zero-shot-classification", model="facebook/bart-large-mnli")
13
  def analyze_sentiment(text):
@@ -15,7 +19,7 @@ def analyze_sentiment(text):
15
  mx = max(results['scores'])
16
  ind = results['scores'].index(mx)
17
  result = results['labels'][ind]
18
- return result
19
 
20
  demo = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="text", title="Sentiment Analysis")
21
  demo.launch(share=True)
 
7
  loaded_model = pickle.load(file)
8
  return loaded_model
9
 
10
+ encoder = {
11
+ 'negative':"a",
12
+ 'neutral':"b",
13
+ 'positive:"c"
14
+ }
15
 
16
  classifier = pipeline(task="zero-shot-classification", model="facebook/bart-large-mnli")
17
  def analyze_sentiment(text):
 
19
  mx = max(results['scores'])
20
  ind = results['scores'].index(mx)
21
  result = results['labels'][ind]
22
+ return encoder[result]
23
 
24
  demo = gr.Interface(fn=analyze_sentiment, inputs="text", outputs="text", title="Sentiment Analysis")
25
  demo.launch(share=True)