Spaces:
Sleeping
Sleeping
File size: 784 Bytes
82a36a6 29cc4c5 82a36a6 8c5eede 82a36a6 48fa8cf 29cc4c5 82a36a6 88f694a 82a36a6 48fa8cf |
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 |
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]
def load_html(file_name):
with open(file_name, 'r') as file:
return file.read()
|