Spaces:
Running
Running
seawolf2357
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,6 @@ from datasets import load_dataset
|
|
8 |
import pandas as pd
|
9 |
from fuzzywuzzy import process
|
10 |
|
11 |
-
|
12 |
# 현재 작업 디렉토리 출력
|
13 |
print("Current Working Directory:", os.getcwd())
|
14 |
|
@@ -33,6 +32,12 @@ def load_optimized_dataset(data_files):
|
|
33 |
name_to_number = full_data.groupby('사건명')['사건번호'].apply(list).to_dict()
|
34 |
summary_to_number = full_data.groupby('판시사항')['사건번호'].apply(list).to_dict()
|
35 |
number_to_fulltext = full_data.set_index('사건번호')['전문'].to_dict()
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
return name_to_number, summary_to_number, number_to_fulltext
|
37 |
|
38 |
name_to_number, summary_to_number, number_to_fulltext = load_optimized_dataset(data_files)
|
@@ -42,6 +47,10 @@ print("Dataset loaded successfully.")
|
|
42 |
all_case_names = list(name_to_number.keys())
|
43 |
all_case_summaries = list(summary_to_number.keys())
|
44 |
|
|
|
|
|
|
|
|
|
45 |
# 로깅 설정
|
46 |
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s: %(message)s', handlers=[logging.StreamHandler()])
|
47 |
|
@@ -105,7 +114,10 @@ async def generate_response(message):
|
|
105 |
# 유사한 사건명 및 판시사항 찾기
|
106 |
matched_case_names = process.extractBests(user_input, all_case_names, limit=3, score_cutoff=70) # score_cutoff 값 조정
|
107 |
matched_case_summaries = process.extractBests(user_input, all_case_summaries, limit=3, score_cutoff=70)
|
108 |
-
|
|
|
|
|
|
|
109 |
if matched_case_names:
|
110 |
case_numbers = []
|
111 |
for case_name, score in matched_case_names:
|
|
|
8 |
import pandas as pd
|
9 |
from fuzzywuzzy import process
|
10 |
|
|
|
11 |
# 현재 작업 디렉토리 출력
|
12 |
print("Current Working Directory:", os.getcwd())
|
13 |
|
|
|
32 |
name_to_number = full_data.groupby('사건명')['사건번호'].apply(list).to_dict()
|
33 |
summary_to_number = full_data.groupby('판시사항')['사건번호'].apply(list).to_dict()
|
34 |
number_to_fulltext = full_data.set_index('사건번호')['전문'].to_dict()
|
35 |
+
|
36 |
+
# 디버깅용 로깅
|
37 |
+
logging.debug(f"Sample entries in name_to_number: {list(name_to_number.items())[:3]}")
|
38 |
+
logging.debug(f"Sample entries in summary_to_number: {list(summary_to_number.items())[:3]}")
|
39 |
+
logging.debug(f"Sample entries in number_to_fulltext: {list(number_to_fulltext.items())[:3]}")
|
40 |
+
|
41 |
return name_to_number, summary_to_number, number_to_fulltext
|
42 |
|
43 |
name_to_number, summary_to_number, number_to_fulltext = load_optimized_dataset(data_files)
|
|
|
47 |
all_case_names = list(name_to_number.keys())
|
48 |
all_case_summaries = list(summary_to_number.keys())
|
49 |
|
50 |
+
# 디버깅용 로깅
|
51 |
+
logging.debug(f"Sample all_case_names: {all_case_names[:3]}")
|
52 |
+
logging.debug(f"Sample all_case_summaries: {all_case_summaries[:3]}")
|
53 |
+
|
54 |
# 로깅 설정
|
55 |
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s:%(levelname)s:%(name)s: %(message)s', handlers=[logging.StreamHandler()])
|
56 |
|
|
|
114 |
# 유사한 사건명 및 판시사항 찾기
|
115 |
matched_case_names = process.extractBests(user_input, all_case_names, limit=3, score_cutoff=70) # score_cutoff 값 조정
|
116 |
matched_case_summaries = process.extractBests(user_input, all_case_summaries, limit=3, score_cutoff=70)
|
117 |
+
|
118 |
+
logging.debug(f"Matched case names: {matched_case_names}")
|
119 |
+
logging.debug(f"Matched case summaries: {matched_case_summaries}")
|
120 |
+
|
121 |
if matched_case_names:
|
122 |
case_numbers = []
|
123 |
for case_name, score in matched_case_names:
|