Download parse.py from sanjayram-a/linkedin-ai-post-generator: direct link, hf CLI and curl.
- Browser
- Download file 769 Bytes
-
https://huggingface.co/spaces/sanjayram-a/linkedin-ai-post-generator/resolve/main/parse.py
- Command line
-
hf download hf://spaces/sanjayram-a/linkedin-ai-post-generator/parse.py
-
curl -L -o parse.py https://huggingface.co/spaces/sanjayram-a/linkedin-ai-post-generator/resolve/main/parse.py
769 Bytes
| import streamlit as st | |
| import pandas as pd | |
| 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 [] | |