Skip to content

Commit

Permalink
Feat : #24 Connect부분 Restapi 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
gilyeon00 committed Sep 27, 2022
1 parent b25ef98 commit 7a6bce4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions service/image_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,30 @@ def saveOriginImage(file) :
database.add_instance(Image, user_id = user_id, origin_url = origin_url, is_deleted = False)

# ai 셀러리 요청, 이제 요 다음부터 비동기처리
convertImage.delay(origin_url)
convertImage(origin_url)

return origin_url




# celery가 처리할 거
# api요청 (ai 서버)
@app.task()
def convertImage(origin_url):
print("convertImage def : ")
result_image = requests.post(AI_CONVERT_API, origin_url)
print("celery가 드디어 제 일을 하네요 ㅠㅠ")
print("convertImage def : 11111111111")
headers = {'Content-Type': 'application/json; chearset=utf-8'}
req = {'img' : origin_url}
print("=========================================")
print(req)
# request : params = request.get_json()
# response : make_photo(params['img'])
result_image = requests.post(AI_CONVERT_API,req)
print("convertImage def : 333333333333")
#result_image.request.get_file()
saveResultImage(result_image)





# 변환된 사진 저장
def saveResultImage(file) :

Expand Down

0 comments on commit 7a6bce4

Please sign in to comment.