Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,10 @@ from email.mime.base import MIMEBase
|
|
13 |
from email import encoders
|
14 |
from datetime import datetime
|
15 |
import numpy as np
|
|
|
|
|
|
|
|
|
16 |
from fastapi import FastAPI, HTTPException, File, Form, UploadFile
|
17 |
from fastapi.middleware.cors import CORSMiddleware
|
18 |
from fastapi.responses import JSONResponse
|
@@ -29,7 +33,7 @@ load_dotenv()
|
|
29 |
# Configure logging
|
30 |
logging.basicConfig(level=logging.INFO)
|
31 |
logger = logging.getLogger(__name__)
|
32 |
-
|
33 |
# Email configuration
|
34 |
EMAIL_SENDER = os.getenv("EMAIL_SENDER", "[email protected]")
|
35 |
EMAIL_PASSWORD = os.getenv("EMAIL_PASSWORD", "your_password")
|
@@ -69,7 +73,7 @@ except Exception as e:
|
|
69 |
# FastAPI setup
|
70 |
app = FastAPI(title="Lost & Found Person Tracker API", version="1.0.0")
|
71 |
|
72 |
-
# CORS middleware
|
73 |
app.add_middleware(
|
74 |
CORSMiddleware,
|
75 |
allow_origins=["*"], # In production, specify allowed origins
|
@@ -1076,4 +1080,3 @@ async def get_statistics():
|
|
1076 |
except Exception as e:
|
1077 |
logger.error(f"Error getting statistics: {e}")
|
1078 |
raise HTTPException(status_code=500, detail="Error retrieving statistics")
|
1079 |
-
|
|
|
13 |
from email import encoders
|
14 |
from datetime import datetime
|
15 |
import numpy as np
|
16 |
+
|
17 |
+
# Set DeepFace home directory before importing DeepFace
|
18 |
+
os.environ['DEEPFACE_HOME'] = '/tmp/.deepface'
|
19 |
+
|
20 |
from fastapi import FastAPI, HTTPException, File, Form, UploadFile
|
21 |
from fastapi.middleware.cors import CORSMiddleware
|
22 |
from fastapi.responses import JSONResponse
|
|
|
33 |
# Configure logging
|
34 |
logging.basicConfig(level=logging.INFO)
|
35 |
logger = logging.getLogger(__name__)
|
36 |
+
|
37 |
# Email configuration
|
38 |
EMAIL_SENDER = os.getenv("EMAIL_SENDER", "[email protected]")
|
39 |
EMAIL_PASSWORD = os.getenv("EMAIL_PASSWORD", "your_password")
|
|
|
73 |
# FastAPI setup
|
74 |
app = FastAPI(title="Lost & Found Person Tracker API", version="1.0.0")
|
75 |
|
76 |
+
# CORS middleware
|
77 |
app.add_middleware(
|
78 |
CORSMiddleware,
|
79 |
allow_origins=["*"], # In production, specify allowed origins
|
|
|
1080 |
except Exception as e:
|
1081 |
logger.error(f"Error getting statistics: {e}")
|
1082 |
raise HTTPException(status_code=500, detail="Error retrieving statistics")
|
|