Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,18 +48,10 @@ if st.button("Annotate"):
|
|
48 |
|
49 |
# Create a DataFrame from the annotated text
|
50 |
df = pd.DataFrame(annotated_text)
|
51 |
-
|
52 |
-
# Create an editable table
|
53 |
-
editable_df = df.copy()
|
54 |
-
for col in df.columns:
|
55 |
-
for idx, value in enumerate(editable_df[col]):
|
56 |
-
new_value = st.text_input(f'{col}_{idx}', value=value)
|
57 |
-
editable_df.at[idx, col] = new_value
|
58 |
-
|
59 |
-
st.table(editable_df)
|
60 |
|
61 |
if st.button("Save Modifications as JSON"):
|
62 |
-
save_annotations_as_json(
|
63 |
st.success("Annotations saved as annotations.json")
|
64 |
|
65 |
else:
|
|
|
48 |
|
49 |
# Create a DataFrame from the annotated text
|
50 |
df = pd.DataFrame(annotated_text)
|
51 |
+
st.dataframe(df)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
if st.button("Save Modifications as JSON"):
|
54 |
+
save_annotations_as_json(df.to_dict(orient='records'), 'annotations.json')
|
55 |
st.success("Annotations saved as annotations.json")
|
56 |
|
57 |
else:
|