ppsingh commited on
Commit
85fa59b
1 Parent(s): 5b25195

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -55
app.py CHANGED
@@ -10,33 +10,39 @@ import numpy as np
10
  # Declaring the variables for later use to talk to dataset
11
 
12
  # the token is saved as secret key-value pair in the environment which can be access as shown below
13
- #auth_token = os.environ.get("space_to_dataset") or True
14
 
15
- #DATASET_REPO_URL = 'ppsingh/annotation_data' # path to dataset repo
16
- #DATA_FILENAME = "paralist.json"
17
- #DATA_FILE = os.path.join("data", DATA_FILENAME)
18
 
19
  # cloning the dataset repo
20
- #repo = Repository( local_dir="data", clone_from=DATASET_REPO_URL, repo_type="dataset", use_auth_token= auth_token)
21
 
22
  # Data file name
23
- #file_name = 'paralist.json'
24
 
25
  # reading the json
26
- #with open('data/{}'.format(file_name), 'r', encoding="utf8") as json_file:
27
- # paraList = json.load(json_file)
 
 
 
 
 
28
 
 
 
 
 
29
  # getting outer level keys in json
30
- #keys = paraList.keys()
31
- #data = pd.read_csv("test.csv")
 
 
32
 
33
  # sidebar with info and drop down to select from the keys
34
- #st.sidebar.markdown(
35
- # """
36
- # Data Annotation Demo
37
- #This app is demo how to use the space to provide user interface for the data annotation/tagging. The data resides in repo_type 'dataset'.
38
- #"""
39
- #)
40
  #topic = None
41
  #if keys is not None:
42
  # topic = st.sidebar.selectbox(
@@ -100,45 +106,7 @@ import numpy as np
100
  # repo.push_to_hub('adding new line')
101
  # st.write('Succcess')
102
 
103
-
104
- import streamlit as st
105
-
106
- col1, col2, col3 = st.columns(3)
107
- #session_state = st.session_state.get(col1=False, col2=False, col3=False)
108
- st.session_state.col1 = False
109
- st.session_state.col2 = False
110
- st.session_state.col3 = False
111
-
112
- col1_one = col1.button("CARTE", key="1")
113
- col2_one = col2.button("TABLEAU", key="2")
114
- col3_one = col3.button("SYNTHÈSE", key="3")
115
-
116
- if col1_one or st.session_state.col1:
117
- st.session_state.col1 = True
118
- st.session_state.col2 = False
119
- st.session_state.col3 = False
120
- sel_Map = st.selectbox("Choose Map type :", options=['Hello1', 'Hello2'], index=1)
121
- if sel_Map == 'Hello1':
122
- st.write("Hello world! 1")
123
- elif sel_Map == 'Hello2':
124
- st.write("Hello world! 2")
125
-
126
- if col2_one or st.session_state.col2:
127
- st.session_state.col1 = False
128
- st.session_state.col2 = True
129
- st.session_state.col3 = False
130
- st.write("Hello world! 3")
131
-
132
- if col3_one or st.session_state.col3:
133
- st.session_state.col1 = False
134
- st.session_state.col2 = False
135
- st.session_state.col3 = True
136
- st.write("Hello world! 4")
137
-
138
- if st.button('Refresh'):
139
- st.session_state.col1 = False
140
- st.session_state.col2 = False
141
- st.session_state.col3 = False
142
 
143
 
144
 
 
10
  # Declaring the variables for later use to talk to dataset
11
 
12
  # the token is saved as secret key-value pair in the environment which can be access as shown below
13
+ auth_token = os.environ.get("space_to_dataset") or True
14
 
15
+ DATASET_REPO_URL = 'ppsingh/annotation_data' # path to dataset repo
16
+ DATA_FILENAME = "paralist.json"
17
+ DATA_FILE = os.path.join("data", DATA_FILENAME)
18
 
19
  # cloning the dataset repo
20
+
21
 
22
  # Data file name
23
+ file_name = 'paralist.json'
24
 
25
  # reading the json
26
+ @st.cache
27
+ def read_dataset():
28
+ repo = Repository( local_dir="data", clone_from=DATASET_REPO_URL, repo_type="dataset", use_auth_token= auth_token)
29
+ with open('data/{}'.format(file_name), 'r', encoding="utf8") as json_file:
30
+ paraList = json.load(json_file)
31
+
32
+ return repo, paraList
33
 
34
+ st.sidebar.markdown("""
35
+ # Data Annotation Demo
36
+ This app is demo how to use the space to provide user interface for the data annotation/tagging. The data resides in repo_type 'dataset'.
37
+ """)
38
  # getting outer level keys in json
39
+ #with st.container():
40
+ # repo, paraList = read_dataset()
41
+
42
+ # keys = paraList.keys()
43
 
44
  # sidebar with info and drop down to select from the keys
45
+
 
 
 
 
 
46
  #topic = None
47
  #if keys is not None:
48
  # topic = st.sidebar.selectbox(
 
106
  # repo.push_to_hub('adding new line')
107
  # st.write('Succcess')
108
 
109
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
 
112