Neural Network Model for solving captchas in Python
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

main.py 744B

1234567891011121314151617181920212223
  1. from fastapi import FastAPI, HTTPException
  2. from pydantic import BaseModel
  3. from typing import Optional
  4. # Suponha que quebrar_captcha_base64 está definido em outro módulo ou arquivo
  5. from solve_captcha import quebrar_captcha_base64
  6. app = FastAPI()
  7. class CaptchaRequest(BaseModel):
  8. base64_string: str
  9. @app.post("/solve_captcha/")
  10. async def solve_captcha(request: CaptchaRequest):
  11. if not request.base64_string:
  12. raise HTTPException(status_code=400, detail="base64_string is required")
  13. try:
  14. resultado_captcha = quebrar_captcha_base64(request.base64_string)
  15. return {"resultado": resultado_captcha}
  16. except Exception as e:
  17. raise HTTPException(status_code=500, detail=str(e))