File size: 731 Bytes
5860e47
 
 
 
 
2b5dadb
5860e47
 
590dbcf
5860e47
 
 
 
 
 
 
 
 
 
 
 
 
446939b
 
 
 
 
6c45df3
 
3dcd2aa
6c45df3
2b5dadb
a1d29af
 
6c4346e
5860e47
 
2b5dadb
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
30
31
32
33
34
35
36
37
38
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}