Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,12 +42,11 @@ if keys is not None:
|
|
| 42 |
topic = st.sidebar.selectbox(
|
| 43 |
label="Choose dataset topic to load", options=keys )
|
| 44 |
# st.write(line)
|
| 45 |
-
st.write(paraList)
|
| 46 |
if topic is not None:
|
| 47 |
-
c1, c2, c3 = st.columns([3, 1, 1])
|
| 48 |
subtopics = list(paraList[topic].keys())
|
| 49 |
#st.write(subtopics)
|
| 50 |
-
val = np.random.randint(0,len(subtopics))
|
| 51 |
choice = subtopics[val]
|
| 52 |
#st.write(choice)
|
| 53 |
#if np.random.randint(0,1) == 0:
|
|
@@ -57,6 +56,7 @@ if topic is not None:
|
|
| 57 |
|
| 58 |
idx = np.random.randint(0,3)
|
| 59 |
|
|
|
|
| 60 |
with c1:
|
| 61 |
st.header('Text')
|
| 62 |
st.write(paraList[topic][choice][idx]['textsegment'])
|
|
@@ -69,16 +69,14 @@ if topic is not None:
|
|
| 69 |
st.header('Feedback')
|
| 70 |
feedback = None
|
| 71 |
feedback = st.selectbox('0 If Tag is not a good keyword for text, 5 for prefect match',(0,1,2,3,4,5))
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
if st.button('Submit'):
|
| 75 |
-
if feedback is not None:
|
| 76 |
paraList[topic][choice][idx]['annotation'].append(feedback)
|
| 77 |
-
with open('data/{}'.format(file_name), 'r', encoding="utf8") as json_file:
|
| 78 |
-
|
| 79 |
-
|
| 80 |
|
| 81 |
-
|
| 82 |
#new_row = title
|
| 83 |
# data = data.append(new_row, ignore_index=True)
|
| 84 |
# st.write(data)
|
|
|
|
| 42 |
topic = st.sidebar.selectbox(
|
| 43 |
label="Choose dataset topic to load", options=keys )
|
| 44 |
# st.write(line)
|
| 45 |
+
# st.write(paraList)
|
| 46 |
if topic is not None:
|
|
|
|
| 47 |
subtopics = list(paraList[topic].keys())
|
| 48 |
#st.write(subtopics)
|
| 49 |
+
val = np.random.randint(0,len(subtopics)-1)
|
| 50 |
choice = subtopics[val]
|
| 51 |
#st.write(choice)
|
| 52 |
#if np.random.randint(0,1) == 0:
|
|
|
|
| 56 |
|
| 57 |
idx = np.random.randint(0,3)
|
| 58 |
|
| 59 |
+
c1, c2, c3 = st.columns([3, 1, 1])
|
| 60 |
with c1:
|
| 61 |
st.header('Text')
|
| 62 |
st.write(paraList[topic][choice][idx]['textsegment'])
|
|
|
|
| 69 |
st.header('Feedback')
|
| 70 |
feedback = None
|
| 71 |
feedback = st.selectbox('0 If Tag is not a good keyword for text, 5 for prefect match',(0,1,2,3,4,5))
|
| 72 |
+
if feedback:
|
| 73 |
+
if st.button('Submit'):
|
|
|
|
|
|
|
| 74 |
paraList[topic][choice][idx]['annotation'].append(feedback)
|
| 75 |
+
# with open('data/{}'.format(file_name), 'r', encoding="utf8") as json_file:
|
| 76 |
+
# json.dump(paraList,json_file, ensure_ascii = True)
|
| 77 |
+
# repo.push_to_hub('added new annotation')
|
| 78 |
|
| 79 |
+
st.write(paraList)
|
| 80 |
#new_row = title
|
| 81 |
# data = data.append(new_row, ignore_index=True)
|
| 82 |
# st.write(data)
|