ppsingh commited on
Commit
e2393a1
1 Parent(s): 35c47c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -10
app.py CHANGED
@@ -3,17 +3,32 @@ import pandas as pd
3
  from huggingface_hub import Repository
4
  import os
5
  from pathlib import Path
6
- import csv
7
 
8
 
9
- # assign directory
10
 
11
- auth_token = os.environ.get("space_to_dataset") or True
 
 
 
 
 
 
 
 
 
 
12
  #data = pd.read_csv("test.csv")
13
  #for line in data:
14
-
 
 
 
 
 
15
  # st.write(line)
16
-
17
  title = st.text_input('Movie title', 'Life of Brian')
18
  if st.button('Submit'):
19
  new_row = title
@@ -22,11 +37,7 @@ if st.button('Submit'):
22
  # st.write(os.getcwd())
23
  # data.to_csv('test.csv', index= False)
24
 
25
- DATASET_REPO_URL = 'ppsingh/annotation_data'
26
- DATA_FILENAME = "test.csv"
27
- DATA_FILE = os.path.join("data", DATA_FILENAME)
28
- repo = Repository( local_dir="data", clone_from=DATASET_REPO_URL, repo_type="dataset", use_auth_token= auth_token)
29
- df = pd.read_csv('data/test.csv')
30
  st.write(df)
31
  # st.write('data/test.csv')
32
  # iterate over files in
 
3
  from huggingface_hub import Repository
4
  import os
5
  from pathlib import Path
6
+ import json
7
 
8
 
9
+ # Declaring the variables for later use to talk to dataset
10
 
11
+ # the token is saved as secret key-value pair in the environment which can be access as shown below
12
+ auth_token = os.environ.get("space_to_dataset") or True
13
+
14
+ DATASET_REPO_URL = 'ppsingh/annotation_data' # path to dataset repo
15
+ DATA_FILENAME = "paralist.json"
16
+ 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
+
22
  #data = pd.read_csv("test.csv")
23
  #for line in data:
24
+ st.sidebar.markdown(
25
+ """
26
+ # Data Annotation Demo
27
+ 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'.
28
+ """
29
+ )
30
  # st.write(line)
31
+
32
  title = st.text_input('Movie title', 'Life of Brian')
33
  if st.button('Submit'):
34
  new_row = title
 
37
  # st.write(os.getcwd())
38
  # data.to_csv('test.csv', index= False)
39
 
40
+
 
 
 
 
41
  st.write(df)
42
  # st.write('data/test.csv')
43
  # iterate over files in