Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,9 +36,7 @@ def root():
|
|
| 36 |
|
| 37 |
@app.get("/health")
|
| 38 |
def health():
|
| 39 |
-
return {
|
| 40 |
-
"status": "ok"
|
| 41 |
-
}
|
| 42 |
|
| 43 |
|
| 44 |
@app.get("/lookup")
|
|
@@ -56,10 +54,13 @@ def lookup(
|
|
| 56 |
detail="number is required"
|
| 57 |
)
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
try:
|
| 65 |
row = con.execute(
|
|
|
|
| 36 |
|
| 37 |
@app.get("/health")
|
| 38 |
def health():
|
| 39 |
+
return {"status": "ok"}
|
|
|
|
|
|
|
| 40 |
|
| 41 |
|
| 42 |
@app.get("/lookup")
|
|
|
|
| 54 |
detail="number is required"
|
| 55 |
)
|
| 56 |
|
| 57 |
+
if not os.path.exists(DB_PATH):
|
| 58 |
+
raise HTTPException(
|
| 59 |
+
status_code=503,
|
| 60 |
+
detail="Authorized index is not installed"
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
con = duckdb.connect(DB_PATH, read_only=True)
|
| 64 |
|
| 65 |
try:
|
| 66 |
row = con.execute(
|