Spaces:
Sleeping
Sleeping
Visuales
Browse files- README.md +2 -2
- main.py +17 -16
- routers/procesador.py +1 -1
README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
---
|
| 2 |
title: Api Blackbox
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
-
short_description:
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
title: Api Blackbox
|
| 3 |
+
emoji: 🧃
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
+
short_description: Para correr cualquier API como una caja negra, independiente de inputs o outputs.
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
main.py
CHANGED
|
@@ -9,14 +9,27 @@ from routers.procesador import router as procesador_router
|
|
| 9 |
|
| 10 |
app = FastAPI(
|
| 11 |
title="API Blackbox",
|
| 12 |
-
description="
|
| 13 |
version="1.0.0",
|
| 14 |
)
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
-
@app.get("/health")
|
| 20 |
async def health_check():
|
| 21 |
"""
|
| 22 |
Health check endpoint.
|
|
@@ -33,19 +46,7 @@ async def health_check():
|
|
| 33 |
)
|
| 34 |
|
| 35 |
|
| 36 |
-
|
| 37 |
-
async def root():
|
| 38 |
-
"""
|
| 39 |
-
Root endpoint.
|
| 40 |
-
|
| 41 |
-
Returns:
|
| 42 |
-
dict: Welcome message
|
| 43 |
-
"""
|
| 44 |
-
return {
|
| 45 |
-
"message": "Welcome to API Blackbox",
|
| 46 |
-
"docs": "/docs",
|
| 47 |
-
"redoc": "/redoc"
|
| 48 |
-
}
|
| 49 |
|
| 50 |
|
| 51 |
if __name__ == "__main__":
|
|
|
|
| 9 |
|
| 10 |
app = FastAPI(
|
| 11 |
title="API Blackbox",
|
| 12 |
+
description="Para correr cualquier API de forma agnóstica a sus inputs, outputs o especificación.",
|
| 13 |
version="1.0.0",
|
| 14 |
)
|
| 15 |
|
| 16 |
+
|
| 17 |
+
@app.get("/", tags=["blackbox"])
|
| 18 |
+
async def root():
|
| 19 |
+
"""
|
| 20 |
+
Root endpoint.
|
| 21 |
+
|
| 22 |
+
Returns:
|
| 23 |
+
dict: Welcome message
|
| 24 |
+
"""
|
| 25 |
+
return {
|
| 26 |
+
"message": "Welcome to API Blackbox",
|
| 27 |
+
"docs": "/docs",
|
| 28 |
+
"redoc": "/redoc"
|
| 29 |
+
}
|
| 30 |
|
| 31 |
|
| 32 |
+
@app.get("/health", tags=["blackbox"])
|
| 33 |
async def health_check():
|
| 34 |
"""
|
| 35 |
Health check endpoint.
|
|
|
|
| 46 |
)
|
| 47 |
|
| 48 |
|
| 49 |
+
app.include_router(procesador_router)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
|
| 52 |
if __name__ == "__main__":
|
routers/procesador.py
CHANGED
|
@@ -66,7 +66,7 @@ def _build_multipart(
|
|
| 66 |
return data, files
|
| 67 |
|
| 68 |
|
| 69 |
-
@router.post("/procesador")
|
| 70 |
async def procesador(
|
| 71 |
manifest: str = Form(..., description="JSON manifest with url, method, headers, body_type, body, etc."),
|
| 72 |
items: list[UploadFile] = File(default=[], description="Optional files referenced in manifest.files"),
|
|
|
|
| 66 |
return data, files
|
| 67 |
|
| 68 |
|
| 69 |
+
@router.post("/procesador", tags=["blackbox"])
|
| 70 |
async def procesador(
|
| 71 |
manifest: str = Form(..., description="JSON manifest with url, method, headers, body_type, body, etc."),
|
| 72 |
items: list[UploadFile] = File(default=[], description="Optional files referenced in manifest.files"),
|