yangheng commited on
Commit
a81d482
·
1 Parent(s): 848d0f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -23,8 +23,8 @@ def inference(text):
23
  result = pd.DataFrame({
24
  'aspect': result[0]['aspect'],
25
  'sentiment': result[0]['sentiment'],
26
- 'confidence': round(result[0]['confidence'], 3),
27
- 'ref_sentiment': result[0]['ref_sentiment'],
28
  'is_correct': result[0]['ref_check'],
29
  })
30
 
@@ -36,13 +36,10 @@ if __name__ == '__main__':
36
  fn=inference,
37
  inputs=["text"],
38
  examples=[
39
- ['The [ASP]battery-life[ASP], and this [ASP]screen[ASP] is ok'],
40
- ['The [ASP] battery-life [ASP] is bad'],
41
- ['The [ASP] battery-life [ASP] is good'],
42
  ['Strong build though which really adds to its [ASP]durability[ASP] .'], # !sent! Positive
43
  ['Strong [ASP]build[ASP] though which really adds to its durability . !sent! Positive'],
44
  ['The [ASP]battery life[ASP] is excellent - 6-7 hours without charging . !sent! Positive'],
45
- ['I have had my computer for 2 weeks already and it [ASP]works[ASP] perfectly . !sent! Positive'],
46
  ['And I may be the only one but I am really liking [ASP]Windows 8[ASP] . !sent! Positive'],
47
  ['This demo is trained on the laptop and restaurant and other review datasets from [ASP]ABSADatasets[ASP] (https://github.com/yangheng95/ABSADatasets)'],
48
  ['To fit on your data, please train the model on your own data, see the [ASP]PyABSA[ASP] (https://github.com/yangheng95/PyABSA)'],
 
23
  result = pd.DataFrame({
24
  'aspect': result[0]['aspect'],
25
  'sentiment': result[0]['sentiment'],
26
+ 'confidence': [round(c, 3) for c in result[0]['confidence']],
27
+ 'ref_sentiment': ['' if ref == '-999' else ref for ref in result[0]['ref_sentiment']],
28
  'is_correct': result[0]['ref_check'],
29
  })
30
 
 
36
  fn=inference,
37
  inputs=["text"],
38
  examples=[
 
 
 
39
  ['Strong build though which really adds to its [ASP]durability[ASP] .'], # !sent! Positive
40
  ['Strong [ASP]build[ASP] though which really adds to its durability . !sent! Positive'],
41
  ['The [ASP]battery life[ASP] is excellent - 6-7 hours without charging . !sent! Positive'],
42
+ ['I have had my [ASP]computer[ASP] for 2 weeks already and it [ASP]works[ASP] perfectly . !sent! Positive, Positive'],
43
  ['And I may be the only one but I am really liking [ASP]Windows 8[ASP] . !sent! Positive'],
44
  ['This demo is trained on the laptop and restaurant and other review datasets from [ASP]ABSADatasets[ASP] (https://github.com/yangheng95/ABSADatasets)'],
45
  ['To fit on your data, please train the model on your own data, see the [ASP]PyABSA[ASP] (https://github.com/yangheng95/PyABSA)'],