jbraha commited on
Commit
ea50b02
1 Parent(s): 9d8cf3d

better table

Browse files
Files changed (2) hide show
  1. .github/workflows/main.yml +1 -1
  2. app.py +7 -6
.github/workflows/main.yml CHANGED
@@ -23,4 +23,4 @@ jobs:
23
  && git switch main
24
  && git merge origin/milestone-3
25
  && git push
26
- && git push -f https://jbraha:$HF_TOKEN@huggingface.co/spaces/jbraha/aiproject
 
23
  && git switch main
24
  && git merge origin/milestone-3
25
  && git push
26
+ && git push https://jbraha:$HF_TOKEN@huggingface.co/spaces/jbraha/aiproject
app.py CHANGED
@@ -25,7 +25,7 @@ def unpack(result):
25
 
26
 
27
  #text insert
28
- input = st.text_area("Insert text to be analyzed", value="Nice to see you today.",
29
  height=None, max_chars=None, key=None, help=None, on_change=None,
30
  args=None, kwargs=None, placeholder=None, disabled=False,
31
  label_visibility="visible")
@@ -47,20 +47,21 @@ else:
47
  classifier = pipeline('sentiment-analysis')
48
 
49
 
 
 
 
 
50
  if st.button('Analyze'):
51
  result = classifier(input)
52
- output = []
53
  result = result[0]
54
  if option == 'Fine-Tuned':
55
  result = unpack(result)
56
- output.append(['Tweet', 'Highest', 'Score', 'Second Highest', 'Score'])
57
  highest = (max(result, key=result.get), result[max(result, key=result.get)])
58
  result.pop(max(result, key=result.get))
59
- output.append([input, max(result, key=result.get), highest[0], highest[1], result[max(result, key=result.get)]])
60
  st.table(output)
61
  else:
62
- output = result
63
- st.write(output)
64
  else:
65
  st.write('Excited to analyze!')
66
 
 
25
 
26
 
27
  #text insert
28
+ input = st.text_area("Insert text to be analyzed", value="you stink",
29
  height=None, max_chars=None, key=None, help=None, on_change=None,
30
  args=None, kwargs=None, placeholder=None, disabled=False,
31
  label_visibility="visible")
 
47
  classifier = pipeline('sentiment-analysis')
48
 
49
 
50
+
51
+ output = []
52
+ output.append(['Tweet', 'Highest', 'Score', 'Second Highest', 'Score'])
53
+
54
  if st.button('Analyze'):
55
  result = classifier(input)
 
56
  result = result[0]
57
  if option == 'Fine-Tuned':
58
  result = unpack(result)
 
59
  highest = (max(result, key=result.get), result[max(result, key=result.get)])
60
  result.pop(max(result, key=result.get))
61
+ output.append([input, highest[0], highest[1], max(result, key=result.get), result[max(result, key=result.get)]])
62
  st.table(output)
63
  else:
64
+ st.write(result)
 
65
  else:
66
  st.write('Excited to analyze!')
67