digitalWestie commited on
Commit
eb909ed
·
1 Parent(s): 9a839b7

change orientation

Browse files
Files changed (1) hide show
  1. app.py +3 -9
app.py CHANGED
@@ -30,21 +30,15 @@ with st.spinner("Loading model..."):
30
  pipe = get_pipe()
31
 
32
  if (submit and len(text.strip()) > 0) or len(text.strip()) > 0:
33
-
34
  prediction = pipe(text)[0]
35
  prediction = sort_predictions(prediction)
36
  max_ylim = prediction[0]['score'] + 0.1
37
-
38
  fig, ax = plt.subplots()
39
- ax.bar(y=[i for i, _ in enumerate(prediction)],
40
- width=[p['score'] for p in prediction],
41
- tick_label=[p['label'] for p in prediction])
42
- ax.tick_params(rotation=90)
43
- ax.set_ylim(0, max_ylim)
44
-
45
  st.header('Result:')
46
  st.pyplot(fig)
47
-
48
  prediction = dict([(p['label'], p['score']) for p in prediction])
49
  st.header('Raw values:')
50
  st.json(prediction)
 
30
  pipe = get_pipe()
31
 
32
  if (submit and len(text.strip()) > 0) or len(text.strip()) > 0:
 
33
  prediction = pipe(text)[0]
34
  prediction = sort_predictions(prediction)
35
  max_ylim = prediction[0]['score'] + 0.1
 
36
  fig, ax = plt.subplots()
37
+ ax.barh([p['label'] for p in prediction], [p['sore'] for p in prediction])
38
+ #ax.tick_params(rotation=0)
39
+ ax.set_xlim(0, max_ylim)
 
 
 
40
  st.header('Result:')
41
  st.pyplot(fig)
 
42
  prediction = dict([(p['label'], p['score']) for p in prediction])
43
  st.header('Raw values:')
44
  st.json(prediction)