from fastapi import FastAPI from app import predict import os from huggingface_hub import login from pydantic import BaseModel from flask import Flask, request import sys sys.setrecursionlimit(10**3) os.environ['HF_HOME'] = '/hug/cache/' os.environ['TRANSFORMERS_CACHE'] = '/blabla/cache/' app = FastAPI() class Item(BaseModel): code: str @app.get("/") async def root(): return {"Code Review Automation":"Version 1.0 'First Draft'"} @app.get("/Hello_world") def hello(): return {"Hello World"} @app.post("/CheckInput") def check(item : Item): return {"output_string" : item.code} @app.post("/ShortsGeneration/") def predict(item: Item): result = predict(item) return {"answer": result}