docker 설정 수정
This commit is contained in:
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
version: "3"
|
||||
services:
|
||||
app:
|
||||
build: .
|
||||
volumes:
|
||||
- .:/opt/workspace # 로컬 디렉토리와 컨테이너 디렉토리 동기화
|
||||
ports:
|
||||
- "8501:8501" # Streamlit 앱 포트 설정
|
||||
container_name: streamlit-rag # 컨테이너 이름 설정
|
||||
@@ -1,6 +1,7 @@
|
||||
FROM pytorch/pytorch:latest
|
||||
WORKDIR /app
|
||||
|
||||
ADD . /opt/workspace
|
||||
WORKDIR /opt/workspace
|
||||
# 필수 패키지 설치
|
||||
RUN apt-get update && apt-get install -y python3-pip
|
||||
|
||||
|
||||
9
main.py
9
main.py
@@ -84,10 +84,15 @@ def load_and_process_documents(directory_path):
|
||||
|
||||
def save_faiss_index(faiss_index, path="faiss_index"):
|
||||
faiss_index.save_local(path)
|
||||
|
||||
print("-------------------------------------------")
|
||||
print("save_faiss_index")
|
||||
print("-------------------------------------------")
|
||||
|
||||
def load_faiss_index(path="faiss_index"):
|
||||
embeddings = embedding()
|
||||
print("-------------------------------------------")
|
||||
print("load_faiss_index")
|
||||
print("-------------------------------------------")
|
||||
return FAISS.load_local(path, embeddings, allow_dangerous_deserialization=True)
|
||||
|
||||
|
||||
@@ -101,6 +106,7 @@ def initialize_processing():
|
||||
try:
|
||||
faiss_index = load_faiss_index(SAVE_VD)
|
||||
except Exception:
|
||||
print("no load_faiss_index")
|
||||
embeddings = embedding()
|
||||
faiss_index = FAISS.from_documents(docs, embeddings)
|
||||
save_faiss_index(faiss_index, SAVE_VD)
|
||||
@@ -168,6 +174,7 @@ if user_input := st.chat_input():
|
||||
|
||||
with st.spinner("문서 검색 및 답변 생성 중..."):
|
||||
docs = reranker.invoke(user_input)
|
||||
print(docs)
|
||||
|
||||
context_texts = "\n\n".join(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user