Spaces:
Runtime error
Runtime error
Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
st.set_page_config(layout="wide")
|
4 |
+
|
5 |
+
segment_len_limit = st.number_input("Minimum segment length (# of words)", min_value=0, max_value=10000,value=100, step = 10)
|
6 |
+
xl1 = st.file_uploader("Choose csv file", key="xl1")
|
7 |
+
if xl1 is not None :
|
8 |
+
#assert that the first few columns are the same
|
9 |
+
df = pd.read_csv(xl1)
|
10 |
+
df = df.drop(["T5 title - Candidates","T5 headline - Candidates", "BART", "BART Meeting"], axis=1)
|
11 |
+
st.title(df["session_title"].iloc[0])
|
12 |
+
with st.form("Headline Candidates"):
|
13 |
+
methods_score = {x:0 for x in df.columns.values if x!="text"}
|
14 |
+
i = 0
|
15 |
+
j = 0
|
16 |
+
for index, row in df.iterrows():
|
17 |
+
#if segment has fewer words than segment_len_limit, ignore it
|
18 |
+
if len(row["text"].split(' ')) < segment_len_limit:
|
19 |
+
continue
|
20 |
+
col1, col2= st.columns(2)
|
21 |
+
with col1:
|
22 |
+
st.write(row["text"])
|
23 |
+
with col2:
|
24 |
+
ignore_segment = st.checkbox("Ignore?", value=False, key=f"{j}_ignore")
|
25 |
+
if ignore_segment:
|
26 |
+
mult = 0
|
27 |
+
else:
|
28 |
+
mult = 1
|
29 |
+
j +=1
|
30 |
+
for method in row.keys():
|
31 |
+
if method=="text":
|
32 |
+
continue
|
33 |
+
methods_score[method] += st.slider(f"{row[method]}",min_value=1,max_value=3,value=2,step=1, key=i) * mult
|
34 |
+
i += 1
|
35 |
+
|
36 |
+
st.markdown("""---""")
|
37 |
+
submitted = st.form_submit_button("Submit")
|
38 |
+
if submitted:
|
39 |
+
st.write(methods_score)
|