Skip to content

Commit

Permalink
Merge pull request #6 from SANHAK-HYUNDAI/feat/issue-5
Browse files Browse the repository at this point in the history
cors 설정 코드 추가
  • Loading branch information
Tianea2160 authored Apr 14, 2023
2 parents bd9d94b + 50850f6 commit 40c009d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pandas as pd
import numpy as np
from fastapi import FastAPI, UploadFile, Form, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from loguru import logger

from ca.core import calculate_similar_multi_processing, calculate_similar_cosine, morphological_analysis
Expand All @@ -19,6 +20,7 @@
insert_size_limit = 10000

app = FastAPI(docs_url="/upload/docs", openapi_url="/upload/openapi.json")
app.add_middleware(CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"])
pool = multiprocessing.Pool(4)


Expand Down Expand Up @@ -234,8 +236,10 @@ async def clear():
await cursor.executemany("insert into ro_big_category (cate_name, count) values (%s, %s)", values)

values = [(sub_cate, 0, big_category[v]) for sub_cate, v in labelling]
await cursor.executemany("insert into ca_sub_category (cate_name, count, big_cate_name) values (%s, %s, %s)", values)
await cursor.executemany("insert into ro_sub_category (cate_name, count, big_cate_name) values (%s, %s, %s)", values)
await cursor.executemany(
"insert into ca_sub_category (cate_name, count, big_cate_name) values (%s, %s, %s)", values)
await cursor.executemany(
"insert into ro_sub_category (cate_name, count, big_cate_name) values (%s, %s, %s)", values)

await conn.commit()
return {"message": "clear success"}

0 comments on commit 40c009d

Please sign in to comment.