File size: 689 Bytes
82a36a6
 
29cc4c5
82a36a6
 
 
 
 
 
8c5eede
82a36a6
29cc4c5
82a36a6
 
88f694a
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
import pandas as pd
import os
import streamlit as st
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("GEMINI_DATA_FILES")

@st.cache_data
def load_data():
    try:
        data = pd.read_csv("data/user-evaluation/merged.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]