File size: 738 Bytes
82a36a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import pandas as pd
import os

from datasets import load_dataset
from dotenv import load_dotenv

load_dotenv()
HF_TOKEN = os.getenv("HF_TOKEN")
REPO_NAME = os.getenv("DATA_REPO")
DATA_FILES = os.getenv("LLAMA_DATA_FILES")


def load_data():
    try:
        #TODO: change this to load the data from the database (buggy for debugging)
        data = pd.read_csv("../data/gemini_results_subset.csv")[:5]
        return data
    except Exception as e:

        print("data not found, loading from huggingface dataset")

        dataset = load_dataset(REPO_NAME, token=True, data_files=DATA_FILES, revision="main")
        dataset.set_format(type='pandas')  ## converting it into pandas
        df = dataset["train"][:]
        return df[:5]