Commit 33089a85 authored by Bhargava Rellu's avatar Bhargava Rellu

test

parent 0c63c8ce
...@@ -7,14 +7,6 @@ from reviewsense.services.ReviewService import ReviewService ...@@ -7,14 +7,6 @@ from reviewsense.services.ReviewService import ReviewService
router = APIRouter() router = APIRouter()
review_service = ReviewService() review_service = ReviewService()
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@router.post("/calculate_ratings/", response_model=Dict[str, Optional[float]]) @router.post("/calculate_ratings/", response_model=Dict[str, Optional[float]])
async def calculate_ratings(input_data: ProductReviewInput): async def calculate_ratings(input_data: ProductReviewInput):
""" """
......
...@@ -15,9 +15,11 @@ class ProductReviewInput(BaseModel): ...@@ -15,9 +15,11 @@ class ProductReviewInput(BaseModel):
"""Pydantic model configuration""" """Pydantic model configuration"""
json_schema_extra = { json_schema_extra = {
"example": { "example": {
"product_id": "iPhone 15 Pro Max", # "product_id": "iPhone 15 Pro Max",
"features": ["camera", "battery"], "product_id": "",
"new_review": "Great phone with excellent battery life!", "features": ["camera", "battery", "display", "design"],
# "new_review": "Great phone with excellent battery life!",
"new_review": "",
"is_rating_evaluation_required": True "is_rating_evaluation_required": True
} }
} }
\ No newline at end of file
from fastapi import FastAPI from fastapi import FastAPI
from reviewsense.api.routes import router from reviewsense.api.routes import router
from reviewsense.core.config import get_settings from reviewsense.core.config import get_settings
from fastapi.middleware.cors import CORSMiddleware
def create_app() -> FastAPI: def create_app() -> FastAPI:
""" """
...@@ -21,6 +22,14 @@ def create_app() -> FastAPI: ...@@ -21,6 +22,14 @@ def create_app() -> FastAPI:
app = create_app() app = create_app()
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
if __name__ == '__main__': if __name__ == '__main__':
import uvicorn import uvicorn
uvicorn.run(app, host='0.0.0.0', port=8000) uvicorn.run(app, host='0.0.0.0', port=8000)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment