LogicGoInfotechSpaces commited on
Commit
ceb3a1e
·
verified ·
1 Parent(s): 303e4bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -1033,7 +1033,7 @@ async def face_swap_api(
1033
  # -----------------------------
1034
  end_time = datetime.utcnow()
1035
  response_time_ms = (end_time - start_time).total_seconds() * 1000
1036
- if database:
1037
  await database.api_logs.insert_one({
1038
  "endpoint": "/face-swap",
1039
  "status": "success",
@@ -1050,7 +1050,7 @@ async def face_swap_api(
1050
  except Exception as e:
1051
  end_time = datetime.utcnow()
1052
  response_time_ms = (end_time - start_time).total_seconds() * 1000
1053
- if database:
1054
  await database.api_logs.insert_one({
1055
  "endpoint": "/face-swap",
1056
  "status": "fail",
@@ -1061,6 +1061,7 @@ async def face_swap_api(
1061
  raise HTTPException(500, f"Face swap failed: {str(e)}")
1062
 
1063
 
 
1064
  # --------------------- Mount Gradio ---------------------
1065
 
1066
  multi_faceswap_app = build_multi_faceswap_gradio()
 
1033
  # -----------------------------
1034
  end_time = datetime.utcnow()
1035
  response_time_ms = (end_time - start_time).total_seconds() * 1000
1036
+ if database is not None:
1037
  await database.api_logs.insert_one({
1038
  "endpoint": "/face-swap",
1039
  "status": "success",
 
1050
  except Exception as e:
1051
  end_time = datetime.utcnow()
1052
  response_time_ms = (end_time - start_time).total_seconds() * 1000
1053
+ if database is not None:
1054
  await database.api_logs.insert_one({
1055
  "endpoint": "/face-swap",
1056
  "status": "fail",
 
1061
  raise HTTPException(500, f"Face swap failed: {str(e)}")
1062
 
1063
 
1064
+
1065
  # --------------------- Mount Gradio ---------------------
1066
 
1067
  multi_faceswap_app = build_multi_faceswap_gradio()