annotation_dev / app.py
ppsingh's picture
Update app.py
da7e215
raw
history blame
1.06 kB
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("TOKEN_FROM_SECRET") or True
#st.write(auth_token)
#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 = {'Sentences': 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, use_auth_token= True)
# 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.writerow('Sentences': new_row)
repo.push_to_hub('adding new line)
st.write('Succcess')