Dataset / getFiles /getHuggingFace.py
vansh9878's picture
files added
825e978
raw
history blame contribute delete
622 Bytes
from datasets import load_dataset
import os
def huggingDataset(url,query):
try:
# query="sentiment analysis"
# url="cornell-movie-review-data/rotten_tomatoes"
dataset = load_dataset(url)
print("Started downloading.....")
os.makedirs("./downloads/"+query,exist_ok=True)
dataset['train'].to_csv("./downloads/"+query+"/"+url[:5]+"train.csv")
dataset['test'].to_csv("./downloads/"+query+"/"+url[:5]+"test.csv")
except:
print("couldn't download hugging face dataset")
# huggingDataset("cornell-movie-review-data/rotten_tomatoes","sentiment analysis")