File size: 1,188 Bytes
46af628
14ff9c4
b62e42f
6169f27
02d9582
da7e215
2fc2e11
02d9582
 
d70c8d8
35c47c7
da7e215
 
 
 
9031d57
 
 
075f350
da7e215
 
 
 
 
 
 
 
075f350
a676f19
c475583
 
da7e215
 
 
 
 
 
 
 
c8b0725
c9be650
48111cb
da7e215
 
 
 
 
b3d7164
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import streamlit as st
import pandas as pd
from huggingface_hub import Repository
import os 
from pathlib import Path
import csv

 
# assign directory

auth_token = os.environ.get("space_to_dataset") or True        
#data = pd.read_csv("test.csv")
#for line in data:

#  st.write(line)
  
title = st.text_input('Movie title', 'Life of Brian')
if st.button('Submit'):
  new_row  = title
#  data = data.append(new_row, ignore_index=True)
#  st.write(data)
#  st.write(os.getcwd())
#  data.to_csv('test.csv', index= False)

DATASET_REPO_URL = 'ppsingh/annotation_data'
DATA_FILENAME = "test.csv"
DATA_FILE = os.path.join("data", DATA_FILENAME)
repo = Repository( local_dir="data", clone_from=DATASET_REPO_URL, repo_type="dataset", use_auth_token= auth_token)
df = pd.read_csv('data/test.csv')
st.write(df)
#   st.write('data/test.csv')
# iterate over files in
# that directory        
directory = os.getcwd()
files = Path(directory).glob('*')
for file in files:
    st.write(file)

with open(DATA_FILE, "a") as csvfile:
  writer = csv.DictWriter(csvfile, fieldnames=["Sentences"])
  writer.writerow({'Sentences': new_row})
  repo.push_to_hub('adding new line')
  st.write('Succcess')