Raiff1982 commited on
Commit
d4b99bd
·
verified ·
1 Parent(s): 55d817f

Update codriao_web_cli.py

Browse files
Files changed (1) hide show
  1. codriao_web_cli.py +11 -3
codriao_web_cli.py CHANGED
@@ -143,8 +143,16 @@ if __name__ == "__main__":
143
  try:
144
  mode = input("Start Codriao in [web] or [cli]? ").strip().lower()
145
  if mode == "cli":
146
- guardian_cli()
147
  else:
148
- demo.launch()
 
 
 
 
 
 
 
 
149
  finally:
150
- asyncio.run(ai_core.http_session.close())
 
143
  try:
144
  mode = input("Start Codriao in [web] or [cli]? ").strip().lower()
145
  if mode == "cli":
146
+ launch_guardian()
147
  else:
148
+ demo.launch() # This will launch Gradio if mode is 'web'
149
+
150
+ finally:
151
+ asyncio.run(ai_core.http_session.close()) # Ensures the HTTP session is properly closed
152
+
153
+ # Function to launch the Codriao Guardian CLI and ensure a clean shutdown
154
+ def launch_guardian():
155
+ try:
156
+ guardian_cli() # This is where the Guardian CLI is launched
157
  finally:
158
+ asyncio.run(ai_core.shutdown())