-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
32 lines (26 loc) · 884 Bytes
/
main.py
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
import os
import sys
from pathlib import Path
import streamlit.web.cli as stcli
from dotenv import load_dotenv
def check_environment():
"""Check if all required environment variables are set"""
if not os.getenv("OPENAI_API_KEY"):
print("Error: OPENAI_API_KEY not found in environment variables")
sys.exit(1)
def init_directories():
"""Initialize required directories"""
Path("data/processed").mkdir(parents=True, exist_ok=True)
Path("data/vector_store").mkdir(parents=True, exist_ok=True)
def main():
"""Main entry point of the application"""
# Load environment variables
load_dotenv()
# Perform initial checks
check_environment()
init_directories()
# Run Streamlit application
sys.argv = ["streamlit", "run", str(Path("src/ui/app.py"))]
sys.exit(stcli.main())
if __name__ == "__main__":
main()