| import streamlit as st
|
| import pandas as pd
|
|
|
| @st.cache_data
|
| def load_posts_context(csv_path="linkedin_sample_posts.csv"):
|
| try:
|
| df = pd.read_csv(csv_path)
|
| required_columns = ["post", "type", "language"]
|
| if not all(col in df.columns for col in required_columns):
|
| raise ValueError(f"CSV file must contain the following columns: {required_columns}")
|
|
|
| posts_list = df.to_dict(orient='records')
|
| return posts_list
|
| except FileNotFoundError:
|
| st.warning(f"Warning: '{csv_path}' not found. No sample posts will be used for context.")
|
| return []
|
| except Exception as e:
|
| st.error(f"Error loading or processing sample posts from {csv_path}: {e}")
|
| return []
|
|
|
|
|
|
|
|
|
|
|