Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,7 @@ print(f"๋ฌธ์์ {len(texts)}๊ฐ์ ๋ฌธ์๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค.")
|
|
36 |
|
37 |
# ์๋ฒ ๋ฉ ๋ชจ๋ธ ๋ก๋
|
38 |
embeddings = HuggingFaceEmbeddings(model_name="intfloat/multilingual-e5-large")
|
|
|
39 |
# ๋ฌธ์์ ์๋ ํ
์คํธ๋ฅผ ์๋ฒ ๋ฉํ๊ณ FAISS ์ ์ธ๋ฑ์ค๋ฅผ ๊ตฌ์ถํจ
|
40 |
index = FAISS.from_documents(
|
41 |
documents=texts,
|
@@ -44,6 +45,7 @@ index = FAISS.from_documents(
|
|
44 |
|
45 |
# faiss_db ๋ก ๋ก์ปฌ์ ์ ์ฅํ๊ธฐ
|
46 |
index.save_local("")
|
|
|
47 |
# faiss_db ๋ก ๋ก์ปฌ์ ๋ก๋ํ๊ธฐ
|
48 |
docsearch = FAISS.load_local("", embeddings)
|
49 |
|
@@ -138,7 +140,7 @@ def gen(x, id, customer_data):
|
|
138 |
)
|
139 |
query=f"๋๋ ํ์ฌ {customer_data_list[index]}๋ง ๊ฐ์
ํ ์ํฉ์ด์ผ. {x}"
|
140 |
response = qa({"query":query})
|
141 |
-
output_str = response['result']
|
142 |
print(prompt_template + output_str)
|
143 |
history[index] += f"๊ณ ๊ฐ:{x}\n์๋ด์:{output_str}\n"
|
144 |
return output_str
|
|
|
36 |
|
37 |
# ์๋ฒ ๋ฉ ๋ชจ๋ธ ๋ก๋
|
38 |
embeddings = HuggingFaceEmbeddings(model_name="intfloat/multilingual-e5-large")
|
39 |
+
|
40 |
# ๋ฌธ์์ ์๋ ํ
์คํธ๋ฅผ ์๋ฒ ๋ฉํ๊ณ FAISS ์ ์ธ๋ฑ์ค๋ฅผ ๊ตฌ์ถํจ
|
41 |
index = FAISS.from_documents(
|
42 |
documents=texts,
|
|
|
45 |
|
46 |
# faiss_db ๋ก ๋ก์ปฌ์ ์ ์ฅํ๊ธฐ
|
47 |
index.save_local("")
|
48 |
+
|
49 |
# faiss_db ๋ก ๋ก์ปฌ์ ๋ก๋ํ๊ธฐ
|
50 |
docsearch = FAISS.load_local("", embeddings)
|
51 |
|
|
|
140 |
)
|
141 |
query=f"๋๋ ํ์ฌ {customer_data_list[index]}๋ง ๊ฐ์
ํ ์ํฉ์ด์ผ. {x}"
|
142 |
response = qa({"query":query})
|
143 |
+
output_str = response['result'].rsplit(".",1)[0]+"."
|
144 |
print(prompt_template + output_str)
|
145 |
history[index] += f"๊ณ ๊ฐ:{x}\n์๋ด์:{output_str}\n"
|
146 |
return output_str
|