Spaces:
Sleeping
Sleeping
Fix scikit-learn version mismatch and visualize R/A/G steps
Browse files- app.py +7 -2
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -171,9 +171,8 @@ def generate_response(chatbot, user_message, analysis_report):
|
|
| 171 |
if not user_message: yield chatbot, ""; return
|
| 172 |
|
| 173 |
# [์ต์ข
์์ ] Gradio 5์ 'Data incompatible' ์๋ฌ ํด๊ฒฐ์ ์ํด ๋ช
์์ ์ธ ๋์
๋๋ฆฌ ํฌ๋งท ์ฌ์ฉ
|
| 174 |
-
# ๋จ, Chatbot ์ปดํฌ๋ํธ ์์ฑ ์ type="messages"๋ฅผ ๋ช
์ํ์ง ์๊ณ , ๋ฐ์ดํฐ ์์ฒด๋ง ๋ง์ถค
|
| 175 |
chatbot.append({"role": "user", "content": user_message})
|
| 176 |
-
chatbot.append({"role": "assistant", "content": "
|
| 177 |
yield chatbot, ""
|
| 178 |
|
| 179 |
try:
|
|
@@ -188,6 +187,9 @@ def generate_response(chatbot, user_message, analysis_report):
|
|
| 188 |
context = "\n\n".join([d.page_content for d in docs])
|
| 189 |
except: pass
|
| 190 |
|
|
|
|
|
|
|
|
|
|
| 191 |
from llm.prompt import QA_PROMPT
|
| 192 |
score_val = analysis_report.get("score", "๋ฏธ์ธก์ ") if isinstance(analysis_report, dict) else "๋ฏธ์ธก์ "
|
| 193 |
query_text = f"โ ๊ณ ๊ฐ ์ ์: {score_val}์ \nโ ์ง๋ฌธ: {user_message}"
|
|
@@ -197,6 +199,9 @@ def generate_response(chatbot, user_message, analysis_report):
|
|
| 197 |
from langchain_core.messages import HumanMessage
|
| 198 |
messages = [HumanMessage(content=full_prompt)]
|
| 199 |
|
|
|
|
|
|
|
|
|
|
| 200 |
answer_buffer = ""
|
| 201 |
for chunk in cons.llm.stream(messages):
|
| 202 |
answer_buffer += chunk.content
|
|
|
|
| 171 |
if not user_message: yield chatbot, ""; return
|
| 172 |
|
| 173 |
# [์ต์ข
์์ ] Gradio 5์ 'Data incompatible' ์๋ฌ ํด๊ฒฐ์ ์ํด ๋ช
์์ ์ธ ๋์
๋๋ฆฌ ํฌ๋งท ์ฌ์ฉ
|
|
|
|
| 174 |
chatbot.append({"role": "user", "content": user_message})
|
| 175 |
+
chatbot.append({"role": "assistant", "content": "๐ [Retrieval] ๊ด๋ จ ๊ท์ ๋ฐ ์ง์นจ์ ๊ฒ์ํ๊ณ ์์ต๋๋ค..."})
|
| 176 |
yield chatbot, ""
|
| 177 |
|
| 178 |
try:
|
|
|
|
| 187 |
context = "\n\n".join([d.page_content for d in docs])
|
| 188 |
except: pass
|
| 189 |
|
| 190 |
+
chatbot[-1] = {"role": "assistant", "content": "๐ง [Augmentation] ๊ฒ์๋ ์ง์์ ๋ฐํ์ผ๋ก ํ๋กฌํํธ๋ฅผ ๊ตฌ์ฑํ๊ณ ์์ต๋๋ค..."}
|
| 191 |
+
yield chatbot, ""
|
| 192 |
+
|
| 193 |
from llm.prompt import QA_PROMPT
|
| 194 |
score_val = analysis_report.get("score", "๋ฏธ์ธก์ ") if isinstance(analysis_report, dict) else "๋ฏธ์ธก์ "
|
| 195 |
query_text = f"โ ๊ณ ๊ฐ ์ ์: {score_val}์ \nโ ์ง๋ฌธ: {user_message}"
|
|
|
|
| 199 |
from langchain_core.messages import HumanMessage
|
| 200 |
messages = [HumanMessage(content=full_prompt)]
|
| 201 |
|
| 202 |
+
chatbot[-1] = {"role": "assistant", "content": "๐ก [Generation] ๋ต๋ณ์ ์์ฑ ์ค์
๋๋ค...\n\n"}
|
| 203 |
+
yield chatbot, ""
|
| 204 |
+
|
| 205 |
answer_buffer = ""
|
| 206 |
for chunk in cons.llm.stream(messages):
|
| 207 |
answer_buffer += chunk.content
|
requirements.txt
CHANGED
|
@@ -3,7 +3,7 @@ pandas
|
|
| 3 |
numpy<2.0.0
|
| 4 |
tensorflow-cpu==2.15.1
|
| 5 |
keras<3.0.0
|
| 6 |
-
scikit-learn
|
| 7 |
langchain>=0.3.0
|
| 8 |
langchain-huggingface
|
| 9 |
langchain-community
|
|
|
|
| 3 |
numpy<2.0.0
|
| 4 |
tensorflow-cpu==2.15.1
|
| 5 |
keras<3.0.0
|
| 6 |
+
scikit-learn==1.6.1
|
| 7 |
langchain>=0.3.0
|
| 8 |
langchain-huggingface
|
| 9 |
langchain-community
|