| import streamlit as st |
| import pandas as pd |
|
|
| |
| st.title('Text Annotation App') |
|
|
| |
| labels = ['Label 1', 'Label 2', 'Label 3'] |
|
|
| |
| user_input = st.text_area("Enter some sentences (one sentence per line)") |
|
|
| |
| sentences = user_input.split('\n') |
|
|
| |
| annotations = [] |
|
|
| |
| for i, sentence in enumerate(sentences): |
| if sentence: |
| |
| label = st.selectbox(f'Choose a label for the following sentence: "{sentence}"', labels, key=i) |
| |
| |
| annotations.append({'Sentence': sentence, 'Label': label}) |
|
|
| |
| if st.button('Save Annotations'): |
| df = pd.DataFrame(annotations) |
| df.to_csv('annotations.csv', index=False) |
| st.write('Annotations saved.') |
|
|