-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
44 lines (36 loc) · 1.14 KB
/
Copy pathmain.py
File metadata and controls
44 lines (36 loc) · 1.14 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
"""
Main entry point for the Procurement Automation System
"""
import os
import subprocess
import sys
import logging
from dotenv import load_dotenv
# Configures logging
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(message)s",
handlers=[
logging.StreamHandler(sys.stdout)
]
)
# Load environment variables
load_dotenv()
def main():
"""Run the procurement automation system."""
try:
# Check for required environment variables
if not os.getenv("OPENAI_API_KEY"):
logging.error("OPENAI_API_KEY environment variable is not set. Please set it in a .env file.")
sys.exit(1)
# Launching the Streamlit UI
logging.info("Starting Procurement Automation System...")
# Command to run the Streamlit app, now we can just python main.py to run the streamlit app
cmd = ["streamlit", "run", "ui/app.py"]
# Run the command
subprocess.run(cmd)
except Exception as e:
logging.error(f"Error starting the application: {str(e)}")
sys.exit(1)
if __name__ == "__main__":
main()