Spaces:
Runtime error
Runtime error
Update codriao_web_cli.py
Browse files- 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 |
-
|
| 147 |
else:
|
| 148 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
finally:
|
| 150 |
-
asyncio.run(ai_core.
|
|
|
|
| 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())
|