Skip to content

bulee5328/AllerLens

Repository files navigation

AllerLens - AI 알레르기 성분 스캐너

CLOVA OCR + LangGraph + RAG (Pinecone) 기반 식품 알레르기 분석 시스템

📁 프로젝트 구조

allerlens/
├── .env.example          # 환경 변수 예시
├── requirements.txt      # 패키지 의존성
├── config.py            # 설정 파일
├── clova_ocr.py         # CLOVA OCR 클라이언트
├── rag_tool.py          # RAG Tool (Pinecone 검색)
├── setup_pinecone.py    # Pinecone DB 초기 설정
├── prompts.py           # 모든 프롬프트 모음
├── state.py             # LangGraph State 정의
├── nodes.py             # LangGraph 노드들
├── graph.py             # LangGraph 워크플로우
├── main.py              # 실행 파일
└── README.md            # 이 파일

🚀 빠른 시작

1. 환경 설정

# 가상환경 생성 (옵션)
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# 패키지 설치
pip install -r requirements.txt

# 환경 변수 설정
cp .env.example .env
# .env 파일을 열어서 API 키 입력

2. Pinecone DB 초기화

python setup_pinecone.py

3. 실행

# 테스트 실행
python main.py

# 또는 특정 이미지로 실행
python main.py --image path/to/image.jpg

🔑 필요한 API 키

  1. CLOVA OCR API

  2. Upstage API

  3. Pinecone API

📝 사용 예시

from graph import app

result = app.invoke({
    "image_path": "s3://bucket/food-label.jpg",
    "user_profile": {
        "name": "홍길동",
        "allergies": ["우유", "땅콩"],
        "intolerances": ["유당"]
    },
    "errors": []
})

print(f"위험도: {result['overall_risk']}")
print(f"설명: {result['explanation']}")

🛠️ 개발 가이드

새로운 알레르기 추가

setup_pinecone.pyallergen_data 리스트에 추가 후 재실행

프롬프트 수정

prompts.py 파일에서 수정

노드 추가/수정

nodes.py 파일에서 수정

📊 성능

  • OCR 처리: ~1.5초
  • RAG 검색: ~0.8초
  • LLM 처리: ~3초
  • 총 처리 시간: ~5초

📄 라이선스

MIT License

About

AI 알레르기 성분 스캐너

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages