Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,8 +22,23 @@ from agent import (
|
|
| 22 |
from utils import parse_action, parse_file_content, read_python_module_structure
|
| 23 |
from datetime import datetime
|
| 24 |
import yaml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
|
|
|
| 27 |
|
| 28 |
# Load custom prompts
|
| 29 |
try:
|
|
@@ -483,6 +498,6 @@ with iface:
|
|
| 483 |
|
| 484 |
iface.load(fn=get_helpful_tip, inputs=agent_dropdown, outputs=ui.info)
|
| 485 |
iface.load(fn=update_sys_prompt, inputs=agent_dropdown, outputs=sys_prompt)
|
| 486 |
-
|
| 487 |
-
|
| 488 |
iface.launch()
|
|
|
|
| 22 |
from utils import parse_action, parse_file_content, read_python_module_structure
|
| 23 |
from datetime import datetime
|
| 24 |
import yaml
|
| 25 |
+
import logging
|
| 26 |
+
|
| 27 |
+
# Create a directory for logs if it doesn't exist
|
| 28 |
+
log_dir = "logs"
|
| 29 |
+
if not os.path.exists(log_dir):
|
| 30 |
+
os.makedirs(log_dir)
|
| 31 |
+
|
| 32 |
+
# Configure logging
|
| 33 |
+
logging.basicConfig(
|
| 34 |
+
filename=os.path.join(log_dir, "gradio_log.txt"),
|
| 35 |
+
level=logging.INFO,
|
| 36 |
+
format="%(asctime)s [%(levelname)s] %(message)s",
|
| 37 |
+
filemode="a+",
|
| 38 |
+
)
|
| 39 |
|
| 40 |
+
# Use the logger
|
| 41 |
+
logger = logging.getLogger(__name__)
|
| 42 |
|
| 43 |
# Load custom prompts
|
| 44 |
try:
|
|
|
|
| 498 |
|
| 499 |
iface.load(fn=get_helpful_tip, inputs=agent_dropdown, outputs=ui.info)
|
| 500 |
iface.load(fn=update_sys_prompt, inputs=agent_dropdown, outputs=sys_prompt)
|
| 501 |
+
# Log messages
|
| 502 |
+
logger.info("Application started")
|
| 503 |
iface.launch()
|