Kyudan commited on
Commit
7708244
·
1 Parent(s): 5cebdc7
Files changed (2) hide show
  1. app.py +3 -2
  2. requirements.txt +1 -0
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import gradio as gr
2
- from langchain.embeddings.huggingface import HuggingFaceEmbeddings
3
- from langchain.vectorstores import FAISS
4
  from openai import OpenAI
5
 
6
  YOUR_OPENAI_API_KEY = "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"
@@ -8,6 +8,7 @@ YOUR_OPENAI_API_KEY = "sk-proj-AnRY6LpPFh6xlPrCB6K7DQSc1__UrS8QQGHXdImYCt_UrOOJY
8
  embedding_model_name = "snunlp/KR-SBERT-V40K-klueNLI-augSTS"
9
  embedding_model = HuggingFaceEmbeddings(
10
  model_name=embedding_model_name,
 
11
  encode_kwargs={"normalize_embeddings": True},
12
  )
13
 
 
1
  import gradio as gr
2
+ from langchain_community.embeddings import HuggingFaceEmbeddings
3
+ from langchain_community.vectorstores import FAISS
4
  from openai import OpenAI
5
 
6
  YOUR_OPENAI_API_KEY = "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"
 
8
  embedding_model_name = "snunlp/KR-SBERT-V40K-klueNLI-augSTS"
9
  embedding_model = HuggingFaceEmbeddings(
10
  model_name=embedding_model_name,
11
+ model_kwargs={"device": "cpu"}, # GPU 설정 시 "cuda"로 변경 가능
12
  encode_kwargs={"normalize_embeddings": True},
13
  )
14
 
requirements.txt CHANGED
@@ -1,3 +1,4 @@
1
  langchain==0.3.13
2
  langchain-community
3
  openai==1.58.1
 
 
1
  langchain==0.3.13
2
  langchain-community
3
  openai==1.58.1
4
+ gradio