Spaces:
Running
Running
File size: 617 Bytes
f9668b6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import pandas as pd
import streamlit as st
@st.cache_data
def load_data(file_path):
data = pd.read_excel(file_path)
return data
def get_random_review(data):
return data['body'].sample(n=1).iloc[0]
@st.cache_resource
def read_prompt(file_path):
try:
with open(file_path, 'r', encoding='utf-8') as file:
instruction = file.read()
return instruction
except FileNotFoundError:
st.error(f"Файл {file_path} не найден.")
st.stop()
except Exception as e:
st.error(f"Ошибка при чтении файла: {e}")
st.stop() |