bestroi commited on
Commit
6940aac
1 Parent(s): dc4a88c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -50,14 +50,9 @@ if st.button("Annotate"):
50
  df = pd.DataFrame(annotated_text)
51
  st.dataframe(df)
52
 
 
 
 
 
53
  else:
54
  st.warning("Please enter some text.")
55
-
56
- if st.button("Save Modifications as JSON"):
57
- if annotated_text:
58
- # Generate a unique file name using a timestamp
59
- timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
60
- filename = f'annotations_{timestamp}.json'
61
- save_annotations_as_json(annotated_text, filename)
62
- st.success(f"Annotations saved as {filename}")
63
-
 
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:
58
  st.warning("Please enter some text.")