Spaces:
Build error
Build error
Show error on empty results
Browse files
app.py
CHANGED
|
@@ -33,23 +33,27 @@ if input.strip():
|
|
| 33 |
|
| 34 |
with overall_tab:
|
| 35 |
st.header("Overall")
|
| 36 |
-
|
| 37 |
-
whole_array =
|
|
|
|
|
|
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
| 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:
|