tensorgirl's picture
Update main.py
430d9b4 verified
raw
history blame
462 Bytes
from fastapi import FastAPI
from app import predict
import os
from huggingface_hub import login
from pydantic import BaseModel
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/")
async def predict(item: Item):
return predict(item.dict())