File size: 1,828 Bytes
4cdaca5
 
 
 
 
 
 
248f723
 
 
 
 
 
369b798
 
 
4cdaca5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248f723
4cdaca5
 
248f723
 
 
 
 
 
 
 
 
 
 
4cdaca5
 
 
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
"""Configuration for AI Radio App"""
import os
from pydantic import BaseModel

class RadioConfig(BaseModel):
    """Configuration for the radio app"""
    
    # API Keys - MUST be set via environment variables (secrets in HF Spaces)
    # These defaults are empty strings - will fail if not set via env vars
    elevenlabs_api_key: str = ""
    llamaindex_api_key: str = ""
    nebius_api_key: str = ""
    
    # Nebius OpenAI-compatible endpoint and model
    nebius_api_base: str = "https://api.tokenfactory.nebius.com/v1/"  # Nebius OpenAI-compatible endpoint
    nebius_model: str = "openai/gpt-oss-120b"  # GPT-OSS-120B model name from Nebius
    
    # Voice Settings
    elevenlabs_voice_id: str = "21m00Tcm4TlvDq8ikWAM"  # Default voice (Rachel)
    
    # Radio Station Settings
    station_name: str = "AI Radio 🎵"
    station_tagline: str = "Your Personal AI-Powered Radio Station"
    
    # Segments configuration
    music_ratio: float = 0.5
    news_ratio: float = 0.2
    podcast_ratio: float = 0.2
    story_ratio: float = 0.1

def get_config() -> RadioConfig:
    """Get configuration from environment variables (secrets in HF Spaces)"""
    config = RadioConfig()
    
    # Read API keys from environment variables (required for HF Spaces)
    # These should be set as Secrets in HuggingFace Spaces Settings
    config.elevenlabs_api_key = os.getenv("ELEVENLABS_API_KEY", "")
    config.llamaindex_api_key = os.getenv("LLAMAINDEX_API_KEY", "")
    config.nebius_api_key = os.getenv("NEBIUS_API_KEY", "")
    
    # Validate that required keys are set
    if not config.elevenlabs_api_key:
        print("⚠️ Warning: ELEVENLABS_API_KEY not set. TTS will not work.")
    if not config.nebius_api_key:
        print("⚠️ Warning: NEBIUS_API_KEY not set. LLM will not work.")
    
    return config