Update main.py
Browse files
main.py
CHANGED
|
@@ -10,9 +10,11 @@ import uvicorn
|
|
| 10 |
import pickle
|
| 11 |
|
| 12 |
app = FastAPI()
|
| 13 |
-
BASE_DIR = "/data/uploaded_images"
|
| 14 |
-
os.makedirs(BASE_DIR, exist_ok=True)
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Ensure base directory exists
|
| 18 |
os.makedirs(BASE_DIR, exist_ok=True)
|
|
@@ -142,5 +144,10 @@ async def check_attendance(org_name: str = Form(...), folder_name: str = Form(..
|
|
| 142 |
except Exception as e:
|
| 143 |
return {"error": f"Internal server error: {str(e)}"}
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
if __name__ == "__main__":
|
| 146 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|
|
|
|
| 10 |
import pickle
|
| 11 |
|
| 12 |
app = FastAPI()
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# Change the base directory to a location with write permissions
|
| 15 |
+
# Use a relative path in the app directory or /tmp
|
| 16 |
+
BASE_DIR = os.path.join(os.getcwd(), "uploaded_images")
|
| 17 |
+
# Alternative: BASE_DIR = "/tmp/uploaded_images"
|
| 18 |
|
| 19 |
# Ensure base directory exists
|
| 20 |
os.makedirs(BASE_DIR, exist_ok=True)
|
|
|
|
| 144 |
except Exception as e:
|
| 145 |
return {"error": f"Internal server error: {str(e)}"}
|
| 146 |
|
| 147 |
+
@app.get("/")
|
| 148 |
+
async def root():
|
| 149 |
+
"""Root endpoint to check if the API is running."""
|
| 150 |
+
return {"message": "Attendance System API is running"}
|
| 151 |
+
|
| 152 |
if __name__ == "__main__":
|
| 153 |
uvicorn.run(app, host="0.0.0.0", port=7860)
|