yufii commited on
Commit
acce371
·
verified ·
1 Parent(s): e59f79b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -8
app.py CHANGED
@@ -38,12 +38,6 @@ app.add_middleware(
38
  async def read_root():
39
  return {"message": "Welcome to the Defects_model API"}
40
 
41
- @app.on_event("startup")
42
- async def startup_event():
43
- # Получаем URL приложения на Hugging Face Spaces
44
- hugging_face_url = os.getenv("SPACE_URL", "URL не найден")
45
- print(f"Приложение запущено и доступно по адресу: {hugging_face_url}")
46
-
47
  filepath = os.path.abspath("cnn_1_v6_final_model.h5")
48
  if not os.path.exists(filepath):
49
  raise FileNotFoundError(f"Model file not found at {filepath}")
@@ -74,9 +68,8 @@ log_file_path = os.path.join("/tmp", "server.log")
74
 
75
  logging.basicConfig(
76
  level=logging.INFO,
77
- filename=log_file_path,
78
- filemode="w",
79
  format="%(asctime)s - %(levelname)s - %(message)s",
 
80
  )
81
 
82
 
 
38
  async def read_root():
39
  return {"message": "Welcome to the Defects_model API"}
40
 
 
 
 
 
 
 
41
  filepath = os.path.abspath("cnn_1_v6_final_model.h5")
42
  if not os.path.exists(filepath):
43
  raise FileNotFoundError(f"Model file not found at {filepath}")
 
68
 
69
  logging.basicConfig(
70
  level=logging.INFO,
 
 
71
  format="%(asctime)s - %(levelname)s - %(message)s",
72
+ handlers=[logging.StreamHandler()] # Log to console
73
  )
74
 
75