from fastapi import FastAPI from fastapi.responses import HTMLResponse from ime import IME app = FastAPI() ime = IME() @app.get("/suggest") def suggest(q: str, k: int = 5): return {"input": q, "suggestions": ime.suggest(q, k=k)} PAGE = """ Manglish → Malayalam IME

Manglish → Malayalam IME

Type Malayalam using English letters.

space or enter = accept first suggestion · click a chip to pick · backspace on empty input deletes last word

""" @app.get("/", response_class=HTMLResponse) def index(): return PAGE