Federico Galatolo commited on
Commit
b0a20ef
1 Parent(s): f05f72b

better control flow

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -54,7 +54,7 @@ def compare():
54
  ))
55
 
56
 
57
- st.plotly_chart(plx.scatter(
58
  data_frame=df,
59
  x="x",
60
  y="y",
@@ -69,9 +69,13 @@ results = [result["_source"] for result in results["hits"]["hits"]]
69
 
70
  documents = {f"{result['title']} - {result['author']}": result['id'] for result in results}
71
 
72
- st.sidebar.title("Semantic compare")
73
  st.sidebar.write("Select documents from the SERICA library to semantically compare them. Hover above the data points to see the respective sentences")
74
  multiselect = st.sidebar.multiselect("Documents", list(documents.keys()))
75
  model = st.sidebar.selectbox("Model", ["LaBSE"])
76
  limit = st.sidebar.number_input("Sentences per document", 1000)
77
- st.sidebar.button("Compare", on_click=compare)
 
 
 
 
 
54
  ))
55
 
56
 
57
+ plot_placeholder.plotly_chart(plx.scatter(
58
  data_frame=df,
59
  x="x",
60
  y="y",
 
69
 
70
  documents = {f"{result['title']} - {result['author']}": result['id'] for result in results}
71
 
72
+ st.sidebar.header("Semantic compare")
73
  st.sidebar.write("Select documents from the SERICA library to semantically compare them. Hover above the data points to see the respective sentences")
74
  multiselect = st.sidebar.multiselect("Documents", list(documents.keys()))
75
  model = st.sidebar.selectbox("Model", ["LaBSE"])
76
  limit = st.sidebar.number_input("Sentences per document", 1000)
77
+
78
+ plot_placeholder = st.empty()
79
+
80
+ if st.sidebar.button("Compare"):
81
+ compare()