imperialwool's picture
Update main.py
46dbb69
raw
history blame contribute delete
846 Bytes
# import main things
from fastapi import Depends, FastAPI, Body
from fastapi.responses import JSONResponse, HTMLResponse
from uvicorn import run
from utils import predict
import datetime
# initing things
app = FastAPI()
@app.get("/")
@app.post("/")
async def root():
return JSONResponse({"detail":"Not Found"}, 404)
@app.get("/amino-captcha-ocr/api/v1/autoregister/version")
async def v(): return {"v": 5, "l": "https://discord.com/channels/897003441539416115/1094970807635157144/1094970807635157144"}
@app.get("/amino-captcha-ocr/api/v1/predict")
async def resolveGet():
return JSONResponse({"detail":"Use POST instead GET"}, 400)
@app.post("/amino-captcha-ocr/api/v1/predict")
async def resolvePost(data = Body()):
print(datetime.datetime.now())
return await predict(data["url"])
run(app, host="0.0.0.0", port=7860)