Transport / hf_config.py
TuanMinhajSeedin's picture
Upload 19 files
04722ba verified
#!/usr/bin/env python3
"""
Hugging Face Spaces specific configuration
"""
import os
def setup_hf_environment():
"""Setup environment variables for Hugging Face Spaces"""
# Set default values for HF Spaces
defaults = {
'PORT': '7860',
'SECRET_KEY': 'transport-query-app-secret-key-2024',
'DEBUG': 'False',
'GOOGLE_MODEL': 'gemini-1.5-flash',
'OPENAI_MODEL': 'gpt-3.5-turbo',
'SIMILARITY_THRESHOLD': '0.8',
'MAX_SUGGESTIONS': '5'
}
# Set defaults if not already set
for key, value in defaults.items():
if key not in os.environ:
os.environ[key] = value
print("🔧 Hugging Face Spaces environment configured")
print(f" Port: {os.environ.get('PORT', '7860')}")
print(f" Debug: {os.environ.get('DEBUG', 'False')}")
print(f" Google Model: {os.environ.get('GOOGLE_MODEL', 'gemini-1.5-flash')}")
print(f" OpenAI Model: {os.environ.get('OPENAI_MODEL', 'gpt-3.5-turbo')}")
# Check for required API keys
if os.environ.get('GOOGLE_API_KEY'):
print("✅ Google API key found")
else:
print("⚠️ Google API key not found - LLM features may not work")
if os.environ.get('OPENAI_API_KEY'):
print("✅ OpenAI API key found")
else:
print("ℹ️ OpenAI API key not found - using Google Gemini only")
# Check Neo4j configuration
if os.environ.get('NEO4J_URI') and os.environ.get('NEO4J_PASSWORD'):
print("✅ Neo4j configuration found")
else:
print("⚠️ Neo4j configuration incomplete - database features may not work")
if __name__ == "__main__":
setup_hf_environment()