--- title: Automated AI Video & Social Media Publisher (n8n converted) emoji: 🚀 colorFrom: purple colorTo: indigo sdk: gradio # Or 'gradio' if you choose to use Gradio for your UI app_file: app.py python_version: "3.10" # Or 3.9, 3.11, etc., as per your preference and compatibility --- # Automated AI Video & Social Media Publisher This Hugging Face Space automates the process of creating AI avatar videos and publishing them to social media. It is a direct Python conversion of an n8n workflow. ## How it Works The workflow performs the following steps: 1. **News Research (Hacker News)**: Fetches the top 10 AI/LLM-related stories from Hacker News and selects the most viral one. 2. **Script Generation (OpenAI)**: Generates a 30-second monologue script for an AI avatar video based on the selected news story and comments. 3. **Caption Generation (OpenAI)**: Creates both long and short captions for social media posts. 4. **AI Video Creation (Heygen)**: Uses the generated script to create an AI avatar video. 5. **Media Upload (Blotato)**: Uploads the generated video to Blotato's media library. 6. **Social Media Publishing (Blotato)**: Publishes the video and captions to various social media platforms (currently YouTube is enabled in the Python code, others are disabled as per the n8n workflow). ## Setup & Secrets To run this Space, you **must** set the following environment variables as **Space Secrets** in the "Settings" tab of your Hugging Face Space: * `OPENAI_API_KEY`: Your OpenAI API key. * `HEYGEN_API_KEY`: Your Heygen API key (a paid Heygen plan is required for video generation, as the free plan is insufficient). * `BLOTATO_API_KEY`: Your Blotato API key. **Optional Environment Variables (set if different from defaults or dynamic):** * `HEYGEN_AVATAR_ID` (Default: `c67f3f55c5fd49d080e19a2ea9666e77`) * `HEYGEN_VOICE_ID` (Default: `e515d746526f448fa533afddc97e4933`) * `HEYGEN_BACKGROUND_VIDEO_URL` (Default: `https://database.blotato.io/storage/v1/object/public/public_media/4ddd33eb-e811-4ab5-93e1-2cd0b7e8fb3f/videogen2-render-e6b398a2-5859-4a77-88ef-2345bcefdc98.mp4`) * `BLOTATO_INSTAGRAM_ID` * `BLOTATO_YOUTUBE_ID` (Default: `5174`) * `BLOTATO_TIKTOK_ID` * `BLOTATO_FACEBOOK_ID` * `BLOTATO_FACEBOOK_PAGE_ID` * `BLOTATO_THREADS_ID` * `BLOTATO_TWITTER_ID` * `BLOTATO_LINKEDIN_ID` * `BLOTATO_PINTEREST_ID` * `BLOTATO_PINTEREST_BOARD_ID` * `BLOTATO_BLUESKY_ID` ---