Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,33 +2,44 @@ import streamlit as st
|
|
2 |
import pandas as pd
|
3 |
from huggingface_hub import Repository
|
4 |
import os
|
5 |
-
# HF_TOKEN = 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
|
6 |
-
#repo = Repository(
|
7 |
-
# local_dir="data", clone_from='ppsingh/annotation_data', use_auth_token=HF_TOKEN
|
8 |
-
#)
|
9 |
from pathlib import Path
|
|
|
10 |
|
11 |
# assign directory
|
12 |
-
directory = os.getcwd()
|
13 |
-
|
14 |
-
# iterate over files in
|
15 |
-
# that directory
|
16 |
-
files = Path(directory).glob('*')
|
17 |
-
for file in files:
|
18 |
-
st.write(file)
|
19 |
|
20 |
auth_token = os.environ.get("TOKEN_FROM_SECRET") or True
|
21 |
-
st.write(auth_token)
|
22 |
-
data = pd.read_csv("test.csv")
|
23 |
-
for line in data:
|
24 |
-
|
|
|
25 |
|
26 |
title = st.text_input('Movie title', 'Life of Brian')
|
27 |
if st.button('Submit'):
|
28 |
new_row = {'Sentences': title}
|
29 |
-
data = data.append(new_row, ignore_index=True)
|
30 |
-
st.write(data)
|
31 |
-
st.write(os.getcwd())
|
32 |
-
data.to_csv('test.csv', index= False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
|
|
|
2 |
import pandas as pd
|
3 |
from huggingface_hub import Repository
|
4 |
import os
|
|
|
|
|
|
|
|
|
5 |
from pathlib import Path
|
6 |
+
import csv
|
7 |
|
8 |
# assign directory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
auth_token = os.environ.get("TOKEN_FROM_SECRET") or True
|
11 |
+
#st.write(auth_token)
|
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 = {'Sentences': title}
|
20 |
+
# data = data.append(new_row, ignore_index=True)
|
21 |
+
# st.write(data)
|
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, use_auth_token= True)
|
29 |
+
|
30 |
+
# iterate over files in
|
31 |
+
# that directory
|
32 |
+
directory = os.getcwd()
|
33 |
+
files = Path(directory).glob('*')
|
34 |
+
for file in files:
|
35 |
+
st.write(file)
|
36 |
+
|
37 |
+
with open(DATA_FILE, "a") as csvfile:
|
38 |
+
writer.writerow('Sentences': new_row)
|
39 |
+
repo.push_to_hub('adding new line)
|
40 |
+
st.write('Succcess')
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
+
|
45 |
|
|