Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,13 +17,19 @@ DATA_FILE = os.path.join("data", DATA_FILENAME)
|
|
17 |
|
18 |
# cloning the dataset repo
|
19 |
repo = Repository( local_dir="data", clone_from=DATASET_REPO_URL, repo_type="dataset", use_auth_token= auth_token)
|
20 |
-
|
|
|
21 |
file_name = 'paralist.json'
|
|
|
|
|
22 |
with open('data/{}'.format(file_name), 'r', encoding="utf8") as json_file:
|
23 |
paraList = json.load(json_file)
|
|
|
|
|
24 |
keys = paraList.keys()
|
25 |
#data = pd.read_csv("test.csv")
|
26 |
-
|
|
|
27 |
st.sidebar.markdown(
|
28 |
"""
|
29 |
# Data Annotation Demo
|
@@ -38,6 +44,7 @@ if keys is not None:
|
|
38 |
|
39 |
if topic is not None:
|
40 |
c1, c2, c3 = st.columns([3, 1, 1])
|
|
|
41 |
|
42 |
|
43 |
|
@@ -55,16 +62,16 @@ if st.button('Submit'):
|
|
55 |
# st.write('data/test.csv')
|
56 |
# iterate over files in
|
57 |
# that directory
|
58 |
-
directory = os.getcwd()
|
59 |
-
files = Path(directory).glob('*')
|
60 |
-
for file in files:
|
61 |
-
st.write(file)
|
62 |
-
|
63 |
-
with open(DATA_FILE, "a") as csvfile:
|
64 |
-
writer = csv.DictWriter(csvfile, fieldnames=["Sentences"])
|
65 |
-
writer.writerow({'Sentences': new_row})
|
66 |
-
repo.push_to_hub('adding new line')
|
67 |
-
st.write('Succcess')
|
68 |
|
69 |
|
70 |
|
|
|
17 |
|
18 |
# cloning the dataset repo
|
19 |
repo = Repository( local_dir="data", clone_from=DATASET_REPO_URL, repo_type="dataset", use_auth_token= auth_token)
|
20 |
+
|
21 |
+
# Data file name
|
22 |
file_name = 'paralist.json'
|
23 |
+
|
24 |
+
# reading the json
|
25 |
with open('data/{}'.format(file_name), 'r', encoding="utf8") as json_file:
|
26 |
paraList = json.load(json_file)
|
27 |
+
|
28 |
+
# getting outer level keys in json
|
29 |
keys = paraList.keys()
|
30 |
#data = pd.read_csv("test.csv")
|
31 |
+
|
32 |
+
# sidebar with info and drop down to select from the keys
|
33 |
st.sidebar.markdown(
|
34 |
"""
|
35 |
# Data Annotation Demo
|
|
|
44 |
|
45 |
if topic is not None:
|
46 |
c1, c2, c3 = st.columns([3, 1, 1])
|
47 |
+
|
48 |
|
49 |
|
50 |
|
|
|
62 |
# st.write('data/test.csv')
|
63 |
# iterate over files in
|
64 |
# that directory
|
65 |
+
#directory = os.getcwd()
|
66 |
+
#files = Path(directory).glob('*')
|
67 |
+
#for file in files:
|
68 |
+
# st.write(file)
|
69 |
+
|
70 |
+
#with open(DATA_FILE, "a") as csvfile:
|
71 |
+
# writer = csv.DictWriter(csvfile, fieldnames=["Sentences"])
|
72 |
+
# writer.writerow({'Sentences': new_row})
|
73 |
+
# repo.push_to_hub('adding new line')
|
74 |
+
# st.write('Succcess')
|
75 |
|
76 |
|
77 |
|