Spaces:
Sleeping
Sleeping
udate
Browse files- Dockerfile +2 -2
- api_server.py +6 -0
Dockerfile
CHANGED
|
@@ -21,8 +21,8 @@ RUN pip install --upgrade pip && pip install -r requirements.txt
|
|
| 21 |
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
-
EXPOSE
|
| 25 |
|
| 26 |
# Optional auth token for API requests:
|
| 27 |
# -e PYTHON_EXTRACTOR_TOKEN=your_token
|
| 28 |
-
CMD ["
|
|
|
|
| 21 |
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
+
EXPOSE 8000
|
| 25 |
|
| 26 |
# Optional auth token for API requests:
|
| 27 |
# -e PYTHON_EXTRACTOR_TOKEN=your_token
|
| 28 |
+
CMD ["sh", "-c", "uvicorn api_server:app --host 0.0.0.0 --port ${PORT:-8000}"]
|
api_server.py
CHANGED
|
@@ -27,6 +27,12 @@ except ImportError:
|
|
| 27 |
app = FastAPI(title="ScriptAI PDF Extractor API", version="1.0.0")
|
| 28 |
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
@app.get("/health")
|
| 31 |
def health() -> dict:
|
| 32 |
return {"ok": True, "service": "pdf-extractor"}
|
|
|
|
| 27 |
app = FastAPI(title="ScriptAI PDF Extractor API", version="1.0.0")
|
| 28 |
|
| 29 |
|
| 30 |
+
@app.get("/")
|
| 31 |
+
def root_health() -> dict:
|
| 32 |
+
# Many platforms probe GET / for health checks.
|
| 33 |
+
return {"ok": True, "service": "pdf-extractor", "endpoint": "/extract-pdf-text"}
|
| 34 |
+
|
| 35 |
+
|
| 36 |
@app.get("/health")
|
| 37 |
def health() -> dict:
|
| 38 |
return {"ok": True, "service": "pdf-extractor"}
|