""" Configuration module for Humanizer System Simplified for Hugging Face Spaces - No .env file needed """ import os from typing import Optional # Simple configuration without pydantic-settings dependency class Settings: """Application settings - Simplified for HF Spaces""" def __init__(self): # Humanizer Configuration self.passes = int(os.getenv("PASSES", "3")) self.temperature = float(os.getenv("TEMPERATURE", "0.95")) # For random variation self.top_p = float(os.getenv("TOP_P", "0.9")) # For vocabulary selection # Quality Check Configuration self.min_variety_score = float(os.getenv("MIN_VARIETY_SCORE", "0.7")) self.max_ai_phrase_hits = int(os.getenv("MAX_AI_PHRASE_HITS", "0")) self.max_retries = int(os.getenv("MAX_RETRIES", "1")) # Export Configuration self.pdf_use_browser = os.getenv("PDF_USE_BROWSER", "true").lower() == "true" self.pdf_use_server = os.getenv("PDF_USE_SERVER", "false").lower() == "true" self.docx_library = os.getenv("DOCX_LIBRARY", "docx") # Server Configuration self.port = int(os.getenv("PORT", "7860")) self.cors_origins = os.getenv("CORS_ORIGINS", "*") self.log_level = os.getenv("LOG_LEVEL", "INFO") # System prompt for three-pass rewriting (conceptual, not for API) THREE_PASS_SYSTEM = """Three-pass rewriting system: Pass 1 → fix clarity and flow Pass 2 → vary rhythm, remove robotic patterns Pass 3 → deeply human tone: organic phrasing, natural variation, subtle conversational shifts, zero AI clichés Rules: - Perform three internal rewriting passes - Preserve ALL Markdown formatting exactly - Return ONLY the final Pass 3 output - No labels, no commentary, no explanations""" # AI phrases for quality check AI_PHRASES = [ "it is important to note", "in conclusion", "furthermore", "it is worth noting", "as an ai", "I'd be happy to", "certainly", "delve into", "leverage", "utilize", "in today's world" ] # Create settings instance settings = Settings() # Add AI_PHRASES to settings for backward compatibility settings.AI_PHRASES = AI_PHRASES # Add THREE_PASS_SYSTEM to settings settings.THREE_PASS_SYSTEM = THREE_PASS_SYSTEM