File size: 1,949 Bytes
9e290f8 d4829ef 9e290f8 d4829ef 9e290f8 d4829ef 9e290f8 4d6d610 9e290f8 d4829ef 9e290f8 d4829ef 9e290f8 e577af3 9e290f8 d4829ef 9e290f8 4f31510 9e290f8 |
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
import time
TIME_INIT = time.time()
from fastapi import FastAPI
# Importing Models and Schemas
from src.dup_ques.main import dup_ques, Schema as DupQuesSchema
from src.movie_reviews.main import movie_reviews, Schema as MovieReviewsSchema
from src.cat_and_dog.main import cat_and_dog, Schema as CatAndDogSchema
from src.face_analytics.main import face_analytics, Schema as FaceAnalyticsSchema
from src.book_rec.main import book_rec, Schema as BookRecSchema
from src.movie_rec.main import movie_rec, Schema as MovieRecSchema
from src.movie_2022_rec.main import movie_2022_rec, Schema as Movie2022RecSchema
# Initializing App
app = FastAPI()
# Allowing Cross Origins
from fastapi.middleware.cors import CORSMiddleware
origins = [
"http://localhost.tiangolo.com",
"https://localhost.tiangolo.com",
"http://localhost",
"http://localhost:8080",
]
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
print(f"\n\n\n ===================== App Started ===================== [ {round(time.time() - TIME_INIT, 3)} seconds ] \n\n\n")
# Endpoints
@app.get("/")
def index():
return "Welcome to the API of PyModelsAI"
@app.post("/dup_ques")
def endpoint_movie_reviews(req: DupQuesSchema):
return dup_ques(req)
@app.post("/movie_reviews")
def endpoint_movie_reviews(req: MovieReviewsSchema):
return movie_reviews(req)
@app.post("/cat_and_dog")
def endpoint_cat_and_dog(req: CatAndDogSchema):
return cat_and_dog(req)
@app.post("/face_analytics")
def endpoint_face_analytics(req: FaceAnalyticsSchema):
return face_analytics(req)
@app.post("/book_rec")
def endpoint_book_rec(req: BookRecSchema):
return book_rec(req)
@app.post("/movie_rec")
def endpoint_movie_rec(req: MovieRecSchema):
return movie_rec(req)
@app.post("/movie_2022_rec")
def endpoint_movie_2022_rec(req: Movie2022RecSchema):
return movie_2022_rec(req) |