refacotr: temp 폴더 삭제

This commit is contained in:
yuhalog 2025-06-19 17:25:01 +09:00
parent 21e7ddeb92
commit 1f8d6c2f4b
3 changed files with 46 additions and 40 deletions

View File

@ -22,11 +22,6 @@ def create_app():
# CORS 설정 # CORS 설정
CORS(app) CORS(app)
# 업로드 폴더 생성
os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
os.makedirs(os.path.join(app.config['UPLOAD_FOLDER'], 'temp'), exist_ok=True)
os.makedirs('templates/poster_templates', exist_ok=True)
# 서비스 인스턴스 생성 # 서비스 인스턴스 생성
poster_service = PosterService() poster_service = PosterService()
sns_content_service = SnsContentService() sns_content_service = SnsContentService()

View File

@ -1,42 +1,53 @@
""" # openai_simple_test.py
마케팅 API 테스트 스크립트
"""
import requests import requests
import json import os
from utils.ai_client import AIClient
import openai
def test_marketing_tip_api(): import base64
"""마케팅 팁 API 테스트"""
# 테스트 데이터
test_data = {
"store_name": "더블샷 카페",
"business_type": "카페",
"location": "서울시 강남구 역삼동",
"seat_count": 30,
}
# API 호출
url = "http://localhost:5001/api/v1/generate-marketing-tip"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer dummy-key"
}
def openai_test(prompt: str,):
try: try:
response = requests.post(url, json=test_data, headers=headers) openai_api_key = os.getenv('OPENAI_API_KEY')
if openai_api_key:
print(f"Status Code: {response.status_code}") openai_client = openai.OpenAI(api_key=openai_api_key)
print(f"Response: {json.dumps(response.json(), ensure_ascii=False, indent=2)}")
if response.status_code == 200:
print("✅ 테스트 성공!")
else: else:
print("❌ 테스트 실패!") openai_client = None
if not openai_client:
raise Exception("OpenAI API 키가 설정되지 않았습니다.")
response = openai_client.images.generate(
model="dall-e-3",
prompt=prompt,
size="1024x1024",
n=1,
)
# # Azure Blob Storage에 업로드
# blob_url = self.blob_client.upload_image(image_data, 'png')
print(f"✅ 이미지 생성 및 업로드 완료: {response}")
return response
except Exception as e: except Exception as e:
print(f"❌ 테스트 오류: {str(e)}") raise Exception(f"이미지 생성 실패: {str(e)}")
if __name__ == "__main__": if __name__ == "__main__":
test_marketing_tip_api() # API 키 확인
if not os.getenv('OPENAI_API_KEY'):
print("⚠️ 환경변수 OPENAI_API_KEY가 설정되지 않았습니다.")
print("코드 상단의 'your-api-key-here' 부분에 실제 API 키를 입력하거나")
print("export OPENAI_API_KEY='실제키' 로 환경변수를 설정해주세요.\n")
openai_test("""아래 정보를 활용하여 사람 그림을 그려주세요.
- 성별 : 여자
- 나이 : 27
- 머리 : 머리 , 아래쪽에 웨이브, 앞머리 약간 있음
- 동양인
- 쌍커풀 없음
- 밝은 이미지
- 웃는 모습
현실적인 모습으로 그려주세요.
사진에 글자가 절대 들어가지 않게 해주세요.
""")

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB