Spaces:
Runtime error
Runtime error
File size: 1,439 Bytes
9b674e9 |
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 |
import os
import sys
from PyQt5.QtWidgets import QApplication
def start(api=False):
"""
Starts the computer assistant application.
This function starts the computer assistant application, which includes parsing command-line arguments
to set the profile, initializing the graphical user interface, and starting the application event loop.
Command-line Arguments:
--profile (str): The profile to use for the application.
Raises:
ImportError: If the required modules or packages are not found.
Returns:
None
"""
try:
import crewai
except:
pass
# get --profile argument with library
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--profile", help="profile to use")
parser.add_argument("--api", help="Enable API mode", action="store_true")
args = parser.parse_args()
profile = args.profile
api_arg = args.api
print("Profile:", profile)
if profile is not None:
from .utils.db import set_profile
set_profile(profile)
try:
from .gpt_computer_assistant import MainWindow
except ImportError:
from gpt_computer_assistant import MainWindow
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
if api or api_arg:
print("API Enabled")
MainWindow.api_enabled = True
app = QApplication(sys.argv)
ex = MainWindow()
sys.exit(app.exec_())
|