tensorgirl's picture
Update main.py
f04865a verified
raw
history blame
623 Bytes
from fastapi import FastAPI
from app import predict
import os
from huggingface_hub import login
from pydantic import BaseModel
import sys
sys.setrecursionlimit(10**4)
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.post("/AutomateReview/")
def predict(item: Item):
result = predict(item)
return {"answer":result}
#async def predict(item: Item):
# result = await predict(item)
# return {"answer":result}