from fastapi import FastAPI
from collections import Counter
from cppy.cp_util import *
import uvicorn

app = FastAPI()

@app.post("/count")
async def count(words_list: dict):  # {"words": ["word1", "word2", ...]}
    word_count = Counter(words_list["words"])
    return {"word_count": dict(word_count)}

if __name__ == "__main__":
    uvicorn.run(app, host="127.0.0.1", port= 7771)