from fastapi import FastAPI from captcha import resolve_captcha from pydantic import BaseModel app = FastAPI() class Item(BaseModel): image_path: str @app.get("/") def greet_json(): return {"Hello": "World!"} @app.get("/resolve_captcha") def decode_captcha(image_path: str): """ Decode the captcha image and return the text. """ try: result = resolve_captcha(image_path) return {"captcha_text": result} except Exception as e: return {"error": str(e)}