-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_app.py
More file actions
83 lines (69 loc) · 2.44 KB
/
run_app.py
File metadata and controls
83 lines (69 loc) · 2.44 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python3
"""
CV Analyzer Pro - Streamlit Application Launcher
"""
import os
import subprocess
import sys
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
def check_dependencies():
"""Check if required dependencies are installed"""
try:
import docling
import pydantic_ai
import streamlit
print("✅ All dependencies are installed")
return True
except ImportError as e:
print(f"❌ Missing dependency: {e}")
print("💡 Please install dependencies with: uv sync")
return False
def setup_environment():
"""Setup environment variables if needed"""
if not os.getenv("OPENAI_API_KEY") and not os.getenv("AWS_ACCESS_KEY_ID"):
print("⚠️ Warning: No AI provider API keys found in environment variables")
print(" For OpenAI: Set OPENAI_API_KEY")
print(" For AWS Bedrock: Set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION")
print()
else:
print("✅ Environment variables loaded successfully")
if os.getenv("OPENAI_API_KEY"):
print(" 🔑 OpenAI API key found")
if os.getenv("AWS_ACCESS_KEY_ID"):
print(" 🔑 AWS credentials found")
print()
def main():
"""Launch the CV Analyzer Pro application"""
print("🚀 CV Analyzer Pro - Launcher")
print("=" * 40)
# Check dependencies
if not check_dependencies():
return 1
# Setup environment
setup_environment()
# Launch Streamlit app
print("🌐 Launching Streamlit application...")
print("📱 The app will open in your default browser")
print("🔗 URL: http://localhost:8501")
print("⏹️ Press Ctrl+C to stop the application")
print()
try:
# Run streamlit
result = subprocess.run([
"uv", "run", "streamlit", "run",
"app/interface.py",
"--server.port", "8501",
"--server.address", "localhost",
"--browser.gatherUsageStats", "false"
], check=True)
return result.returncode
except subprocess.CalledProcessError as e:
print(f"❌ Error launching application: {e}")
return 1
except KeyboardInterrupt:
print("\n👋 Application stopped by user")
return 0
if __name__ == "__main__":
sys.exit(main())