Download app.py from Quextro/MinerU: direct link, hf CLI and curl.
- Browser
- Download file 868 Bytes
-
https://huggingface.co/spaces/Quextro/MinerU/resolve/main/app.py
- Command line
-
hf download hf://spaces/Quextro/MinerU/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Quextro/MinerU/resolve/main/app.py
868 Bytes
| #!/usr/bin/env python3 | |
| import os | |
| import json | |
| import uuid | |
| import uvicorn | |
| import pika | |
| import logging | |
| from fastapi import FastAPI, Body, Header, HTTPException | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from worker import main as rabbit_worker | |
| logging.basicConfig( | |
| level=logging.INFO, | |
| format="%(asctime)s [%(levelname)s] %(name)s - %(message)s" | |
| ) | |
| logger = logging.getLogger(__name__) | |
| app = FastAPI() | |
| API_KEY = os.getenv("SECRET_KEY") | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| async def root(): | |
| logger.info("Root endpoint called.") | |
| return {"status": "ok", "message": "API is running"} | |
| if __name__ == "__main__": | |
| os.system('python download_models_hf.py') | |
| rabbit_worker() | |
| uvicorn.run(app, host="0.0.0.0", port=8000) |