Spaces:
Running
Running
import pandas as pd | |
import streamlit as st | |
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] | |
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() |