seawolf2357 commited on
Commit
c1c1dea
ยท
verified ยท
1 Parent(s): 6eaab32

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -7,9 +7,6 @@ import subprocess
7
  from datasets import load_dataset
8
  import pandas as pd
9
  from fuzzywuzzy import process
10
-
11
-
12
-
13
  # ํ˜„์žฌ ์ž‘์—… ๋””๋ ‰ํ† ๋ฆฌ ์ถœ๋ ฅ
14
  print("Current Working Directory:", os.getcwd())
15
 
@@ -30,12 +27,17 @@ else:
30
  def load_optimized_dataset(data_files):
31
  data_frames = [pd.read_csv(file) for file in data_files]
32
  full_data = pd.concat(data_frames, ignore_index=True)
 
33
  # ํ™•์ธ์„ ์œ„ํ•œ ๋ฐ์ดํ„ฐ ์ƒ˜ํ”Œ ์ถœ๋ ฅ
34
- logging.debug(f"Data sample: {full_data[['์‚ฌ๊ฑด๋ช…', '์‚ฌ๊ฑด๋ฒˆํ˜ธ', 'ํŒ์‹œ์‚ฌํ•ญ']].head()}")
 
 
 
35
  # ์‚ฌ๊ฑด๋ช…์„ ํ‚ค๋กœ ํ•˜๊ณ  ์‚ฌ๊ฑด๋ฒˆํ˜ธ์™€ ์ „๋ฌธ์„ ์ €์žฅํ•˜๋Š” ๋”•์…”๋„ˆ๋ฆฌ ์ƒ์„ฑ
36
  name_to_number = full_data.groupby('์‚ฌ๊ฑด๋ช…')['์‚ฌ๊ฑด๋ฒˆํ˜ธ'].apply(list).to_dict()
37
  summary_to_number = full_data.groupby('ํŒ์‹œ์‚ฌํ•ญ')['์‚ฌ๊ฑด๋ฒˆํ˜ธ'].apply(list).to_dict()
38
  number_to_fulltext = full_data.set_index('์‚ฌ๊ฑด๋ฒˆํ˜ธ')['์ „๋ฌธ'].to_dict()
 
39
  return name_to_number, summary_to_number, number_to_fulltext
40
 
41
  name_to_number, summary_to_number, number_to_fulltext = load_optimized_dataset(data_files)
@@ -147,4 +149,4 @@ async def generate_response(message):
147
 
148
  if __name__ == "__main__":
149
  discord_client = MyClient(intents=intents)
150
- discord_client.run(os.getenv('DISCORD_TOKEN'))
 
7
  from datasets import load_dataset
8
  import pandas as pd
9
  from fuzzywuzzy import process
 
 
 
10
  # ํ˜„์žฌ ์ž‘์—… ๋””๋ ‰ํ† ๋ฆฌ ์ถœ๋ ฅ
11
  print("Current Working Directory:", os.getcwd())
12
 
 
27
  def load_optimized_dataset(data_files):
28
  data_frames = [pd.read_csv(file) for file in data_files]
29
  full_data = pd.concat(data_frames, ignore_index=True)
30
+
31
  # ํ™•์ธ์„ ์œ„ํ•œ ๋ฐ์ดํ„ฐ ์ƒ˜ํ”Œ ์ถœ๋ ฅ
32
+ print(full_data[['์‚ฌ๊ฑด๋ช…', '์‚ฌ๊ฑด๋ฒˆํ˜ธ', 'ํŒ์‹œ์‚ฌํ•ญ']].head()) # 'ํŒ์‹œ์‚ฌํ•ญ' ํ•„๋“œ์˜ ๋ฐ์ดํ„ฐ ์ƒ˜ํ”Œ ์ถœ๋ ฅ
33
+ logging.debug(f"Columns in dataset: {full_data.columns}")
34
+ logging.debug(f"Sample data from 'ํŒ์‹œ์‚ฌํ•ญ': {full_data['ํŒ์‹œ์‚ฌํ•ญ'].dropna().head()}")
35
+
36
  # ์‚ฌ๊ฑด๋ช…์„ ํ‚ค๋กœ ํ•˜๊ณ  ์‚ฌ๊ฑด๋ฒˆํ˜ธ์™€ ์ „๋ฌธ์„ ์ €์žฅํ•˜๋Š” ๋”•์…”๋„ˆ๋ฆฌ ์ƒ์„ฑ
37
  name_to_number = full_data.groupby('์‚ฌ๊ฑด๋ช…')['์‚ฌ๊ฑด๋ฒˆํ˜ธ'].apply(list).to_dict()
38
  summary_to_number = full_data.groupby('ํŒ์‹œ์‚ฌํ•ญ')['์‚ฌ๊ฑด๋ฒˆํ˜ธ'].apply(list).to_dict()
39
  number_to_fulltext = full_data.set_index('์‚ฌ๊ฑด๋ฒˆํ˜ธ')['์ „๋ฌธ'].to_dict()
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)
 
149
 
150
  if __name__ == "__main__":
151
  discord_client = MyClient(intents=intents)
152
+ discord_client.run(os.getenv('DISCORD_TOKEN'))