File size: 2,374 Bytes
7c956fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""

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