Yapp99 commited on
Commit
383b5c7
·
1 Parent(s): faf1fab

Show error on empty results

Browse files
Files changed (1) hide show
  1. app.py +18 -14
app.py CHANGED
@@ -33,23 +33,27 @@ if input.strip():
33
 
34
  with overall_tab:
35
  st.header("Overall")
36
- print([res.job.status() for res in results])
37
- whole_array = np.concatenate([np.sum(res.array, axis=-1) for res in results if res.job.done()])
 
 
38
 
39
- total = len(whole_array)
40
- value, count = np.unique(whole_array,return_counts=True)
41
- count = count/total*100
42
 
43
- df = pd.DataFrame({
44
- "Bit Value" : value,
45
- "Percentage" : count,
46
- })
47
 
48
- col1, col2 = st.columns([1,2])
49
- with col1:
50
- st.dataframe(df, hide_index=True)
51
- with col2:
52
- st.pyplot(plot_data(whole_array))
 
 
53
 
54
  for idx, (tab, result) in enumerate(zip(detail_tabs, results)):
55
  with tab:
 
33
 
34
  with overall_tab:
35
  st.header("Overall")
36
+
37
+ whole_array = [np.sum(res.array, axis=-1) for res in results if res.job.done()]
38
+ if len(whole_array):
39
+ whole_array = np.concatenate(whole_array)
40
 
41
+ total = len(whole_array)
42
+ value, count = np.unique(whole_array,return_counts=True)
43
+ count = count/total*100
44
 
45
+ df = pd.DataFrame({
46
+ "Bit Value" : value,
47
+ "Percentage" : count,
48
+ })
49
 
50
+ col1, col2 = st.columns([1,2])
51
+ with col1:
52
+ st.dataframe(df, hide_index=True)
53
+ with col2:
54
+ st.pyplot(plot_data(whole_array))
55
+ else:
56
+ st.write("Input sentences are too big to be processed, try breaking them into smaller sentences")
57
 
58
  for idx, (tab, result) in enumerate(zip(detail_tabs, results)):
59
  with tab: