Spaces:
Runtime error
Runtime error
File size: 623 Bytes
5846481 430d9b4 9cb52f4 0010700 5846481 430d9b4 5846481 837bb05 5846481 f04865a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
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} |