MinerU / app.py
princhman's picture
final update of the logic
0aedcf3
raw
history blame
693 Bytes
#!/usr/bin/env python3
import os
import json
import uuid
import uvicorn
import pika
from fastapi import FastAPI, Body, Header, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from worker import main as rabbit_worker
app = FastAPI()
API_KEY = os.getenv("SECRET_KEY")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
async def root():
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)