williamufpr commited on
Commit ·
cf8465e
1
Parent(s): 9a80c0a
🚧 Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,35 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
|
| 3 |
-
app = FastAPI(
|
|
|
|
|
|
|
|
|
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
@app.get("/")
|
| 6 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
return {"Hello": "World!"}
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
|
| 3 |
+
app = FastAPI(
|
| 4 |
+
title="ZeloTech API v1",
|
| 5 |
+
version="0.1.0"
|
| 6 |
+
)
|
| 7 |
|
| 8 |
+
app.add_middleware(
|
| 9 |
+
CORSMiddleware,
|
| 10 |
+
allow_origins=["*"],
|
| 11 |
+
allow_credentials=True,
|
| 12 |
+
allow_methods=["*"],
|
| 13 |
+
allow_headers=["*"],
|
| 14 |
+
)
|
| 15 |
@app.get("/")
|
| 16 |
+
def root():
|
| 17 |
+
return {
|
| 18 |
+
"service": "Documment Inspector",
|
| 19 |
+
"status": "running"
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
@app.get("/health")
|
| 23 |
+
def health():
|
| 24 |
+
return {
|
| 25 |
+
"status": "ok"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
@app.post("/analyze")
|
| 29 |
+
async def analyze_document(file: UploadFile = File(...)):
|
| 30 |
+
|
| 31 |
+
content = await file.read()
|
| 32 |
+
return {
|
| 33 |
+
"filename": file.filename,
|
| 34 |
+
greet_json():
|
| 35 |
return {"Hello": "World!"}
|