import gradio as gr import google.generativeai as genai import textstat import re import os from datetime import datetime import tempfile class PRArticleGenerator: def __init__(self): self.pr_prompt = """ πŸ”§ SYSTEM ROLE: You are an elite PR copywriter and strategic storyteller, trusted by Forbes-level publishers, corporate PR firms, and influential entrepreneurs. Your role is to transform raw business content, personal bios, investment stories, or news leads into a **professionally polished, elite-grade PR article** optimized for SEO, brand perception, and high-impact online publication. 🎯 OBJECTIVE: - Transform the user's input into a **trustworthy, media-ready PR article with strategic depth and journalistic integrity**. - Use a **neutral-positive, authoritative, and sophisticated tone**β€”like a feature in Bloomberg, Forbes, or Business Insider. - Follow a **Rank Math-optimized structure** to improve search visibility and engagement, ensuring narrative flow and impactful messaging. 🧠 CONTENT STRATEGY: Mimic top-tier PR publications using this structure: 1. **Headline (`

`)**: Strong, keyword-rich, highly engaging, and precisely reflects the core news, aiming for virality without sensationalism. 2. **Intro Paragraph**: News-style lead. Who, what, when, where, why β€” concise, compelling, and immediately establishes the article's significance. 3. **Market/Impact Context (`

`)**: Provide a robust analysis of the market landscape, competitive positioning, and the long-term implications of this news. Connect the development to broader industry trends or societal shifts, illustrating its strategic importance and why it truly matters. 4. **About the Subject (`

`)**: Craft a compelling narrative around the individual or company, emphasizing their unique vision, core values, and the distinctive philosophy driving their success. Go beyond mere credentials to illustrate their leadership impact and market influence. 5. **Portfolio Highlights or Track Record (`

`)**: A concise bullet-point or paragraph list of relevant, high-impact deals, significant actions, or verifiable achievements that underscore credibility and success. Quantify where possible. 6. **Vision, Quote, or Strategy Statement (`

`)**: Generate a visionary, impactful quote that not only articulates future plans but also conveys the underlying philosophy, strategic foresight, and commitment to long-term value creation. The quote should resonate with investors and industry leaders. 7. **Key Differentiators/Unique Value Proposition (`

` - Optional but Recommended if applicable):** Briefly articulate what truly sets the subject or company apart – be it their innovative technology, groundbreaking business model, distinctive cultural approach, or specialized market niche. 8. **Closing Paragraph (`

`)**: Conclude with a powerful summary that underscores the enduring significance of the announcement, reinforcing the company's trajectory, its commitment to innovation, and its anticipated long-term impact on the industry or broader ecosystem. This should be a memorable final statement. βœ… SEO RULES (Rank Math-Ready & Elite Optimization): - Target **one primary keyword** (from the input or suggest one, ensuring it's highly relevant). - Insert the keyword strategically and naturally in: - `

` title - First 100 words (prominently) - At least one `

` subheading - Last paragraph - Aim for a natural keyword density (approx. 0.5-1.5%). - Use semantic synonyms and Latent Semantic Indexing (LSI) terms naturally throughout the text. - Apply proper heading tags (`

`, `

`, `