Soumik555 commited on
Commit
53bf2dd
·
1 Parent(s): ec288f0

added csv-agent-default in next.js

Browse files
Files changed (1) hide show
  1. main.py +9 -0
main.py CHANGED
@@ -19,6 +19,7 @@ import warnings
19
  from fastapi.concurrency import run_in_threadpool
20
  from fastapi import Depends, HTTPException, status
21
  from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
 
22
 
23
  load_dotenv()
24
 
@@ -38,6 +39,10 @@ security = HTTPBearer()
38
 
39
  scheduler = init_scheduler()
40
 
 
 
 
 
41
  @app.get("/ping")
42
  def health_check():
43
  return {"status": "ok"}
@@ -100,6 +105,10 @@ async def execute_code(
100
  csv_url = code_request.get("csv_url")
101
  df = pd.read_csv(csv_url) if csv_url else None
102
 
 
 
 
 
103
  try:
104
  # Run the code execution in a separate thread
105
  result = await run_in_threadpool(execute_python_code, code, df)
 
19
  from fastapi.concurrency import run_in_threadpool
20
  from fastapi import Depends, HTTPException, status
21
  from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
22
+ import logging
23
 
24
  load_dotenv()
25
 
 
39
 
40
  scheduler = init_scheduler()
41
 
42
+ logging.basicConfig(level=logging.INFO)
43
+ logger = logging.getLogger(__name__)
44
+
45
+
46
  @app.get("/ping")
47
  def health_check():
48
  return {"status": "ok"}
 
105
  csv_url = code_request.get("csv_url")
106
  df = pd.read_csv(csv_url) if csv_url else None
107
 
108
+ logger.info(f"Executing Python code: {code}")
109
+ logger.info(f"CSV URL: {csv_url}")
110
+ logger.info(f"DataFrame: {df}")
111
+
112
  try:
113
  # Run the code execution in a separate thread
114
  result = await run_in_threadpool(execute_python_code, code, df)