Spaces:
Build error
Build error
Update app.py
Browse files9 unmodified lines10111213141516171819202122232425262728293031323334353637383940414257 unmodified lines1001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431449 unmodified lines# Declaring the variables for later use to talk to dataset# the token is saved as secret key-value pair in the environment which can be access as shown below#auth_token = os.environ.get("space_to_dataset") or True#DATASET_REPO_URL = 'ppsingh/annotation_data' # path to dataset repo#DATA_FILENAME = "paralist.json"#DATA_FILE = os.path.join("data", DATA_FILENAME)# cloning the dataset repo#repo = Repository( local_dir="data", clone_from=DATASET_REPO_URL, repo_type="dataset", use_auth_token= auth_token)# Data file name#file_name = 'paralist.json'# reading the json#with open('data/{}'.format(file_name), 'r', encoding="utf8") as json_file:# paraList = json.load(json_file)# getting outer level keys in json#keys = paraList.keys()#data = pd.read_csv("test.csv")# sidebar with info and drop down to select from the keys#st.sidebar.markdown(# """# Data Annotation Demo#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'.#"""#)#topic = None#if keys is not None:# topic = st.sidebar.selectbox(57 unmodified lines# repo.push_to_hub('adding new line')# st.write('Succcess')import streamlit as stcol1, col2, col3 = st.columns(3)#session_state = st.session_state.get(col1=False, col2=False, col3=False)st.session_state.col1 = Falsest.session_state.col2 = Falsest.session_state.col3 = Falsecol1_one = col1.button("CARTE", key="1")col2_one = col2.button("TABLEAU", key="2")col3_one = col3.button("SYNTHÈSE", key="3")if col1_one or st.session_state.col1:st.session_state.col1 = Truest.session_state.col2 = Falsest.session_state.col3 = Falsesel_Map = st.selectbox("Choose Map type :", options=['Hello1', 'Hello2'], index=1)if sel_Map == 'Hello1':st.write("Hello world! 1")elif sel_Map == 'Hello2':st.write("Hello world! 2")if col2_one or st.session_state.col2:st.session_state.col1 = Falsest.session_state.col2 = Truest.session_state.col3 = Falsest.write("Hello world! 3")if col3_one or st.session_state.col3:st.session_state.col1 = Falsest.session_state.col2 = Falsest.session_state.col3 = Truest.write("Hello world! 4")if st.button('Refresh'):st.session_state.col1 = Falsest.session_state.col2 = Falsest.session_state.col3 = False9 unmodified lines10111213141516171819202122232425262728293031323334353637383940414243444546474857 unmodified lines1061071081091101111129 unmodified lines# Declaring the variables for later use to talk to dataset# the token is saved as secret key-value pair in the environment which can be access as shown belowauth_token = os.environ.get("space_to_dataset") or TrueDATASET_REPO_URL = 'ppsingh/annotation_data' # path to dataset repoDATA_FILENAME = "paralist.json"DATA_FILE = os.path.join("data", DATA_FILENAME)# cloning the dataset repo# Data file namefile_name = 'paralist.json'# reading the json@st.cachedef read_dataset():repo = Repository( local_dir="data", clone_from=DATASET_REPO_URL, repo_type="dataset", use_auth_token= auth_token)with open('data/{}'.format(file_name), 'r', encoding="utf8") as json_file:paraList = json.load(json_file)return repo, paraListst.sidebar.markdown("""# Data Annotation DemoThis app is demo how to use the space to provide user interface for the data annotation/tagging. The data resides in repo_type 'dataset'.""")# getting outer level keys in json#with st.container():# repo, paraList = read_dataset()# keys = paraList.keys()# sidebar with info and drop down to select from the keys#topic = None#if keys is not None:# topic = st.sidebar.selectbox(57 unmodified lines# repo.push_to_hub('adding new line')# st.write('Succcess')
app.py+23-55