Mengyuan Liu commited on
Commit
73c1b48
·
verified ·
1 Parent(s): 521f9d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -15,6 +15,13 @@ def on_confirm(dataset_radio, num_parts_dropdown, token_counts_radio, line_count
15
  cyclomatic_complexity_split = cyclomatic_complexity_radio
16
 
17
  dataframes = []
 
 
 
 
 
 
 
18
  if token_counts_split=="Equal Frequency Partitioning":
19
  token_counts_df = pd.read_csv(f"/dividing_into_different_subsets/{num_parts}/QS/token_counts_QS.csv")
20
  dataframes.append(token_counts_df)
@@ -31,7 +38,7 @@ def on_confirm(dataset_radio, num_parts_dropdown, token_counts_radio, line_count
31
  combined_df = dataframes[0]
32
  for df in dataframes[1:]:
33
  combined_df = pd.merge(combined_df, df, left_index=True, right_index=True, suffixes=('', '_y'))
34
- combined_df = combined_df.loc[:, ~combined_df.columns.str.endswith('_y')] # 去除重复的列
35
  return combined_df
36
  else:
37
  return pd.DataFrame()
@@ -46,7 +53,6 @@ def execute_specified_python_files(directory_list, file_list):
46
  if os.path.isfile(file_path) and py_file.endswith('.py'):
47
  print(f"Executing {file_path}...")
48
  try:
49
- # 使用subprocess执行Python文件
50
  subprocess.run(['python', file_path], check=True)
51
  print(f"{file_path} executed successfully.")
52
  except subprocess.CalledProcessError as e:
 
15
  cyclomatic_complexity_split = cyclomatic_complexity_radio
16
 
17
  dataframes = []
18
+ script_path = os.path.abspath(__file__)
19
+
20
+ # 获取当前脚本所在的目录
21
+ script_dir = os.path.dirname(script_path)
22
+
23
+ print("当前脚本文件的绝对路径:", script_path)
24
+ print("当前脚本文件所在的目录:", script_dir)
25
  if token_counts_split=="Equal Frequency Partitioning":
26
  token_counts_df = pd.read_csv(f"/dividing_into_different_subsets/{num_parts}/QS/token_counts_QS.csv")
27
  dataframes.append(token_counts_df)
 
38
  combined_df = dataframes[0]
39
  for df in dataframes[1:]:
40
  combined_df = pd.merge(combined_df, df, left_index=True, right_index=True, suffixes=('', '_y'))
41
+ combined_df = combined_df.loc[:, ~combined_df.columns.str.endswith('_y')]
42
  return combined_df
43
  else:
44
  return pd.DataFrame()
 
53
  if os.path.isfile(file_path) and py_file.endswith('.py'):
54
  print(f"Executing {file_path}...")
55
  try:
 
56
  subprocess.run(['python', file_path], check=True)
57
  print(f"{file_path} executed successfully.")
58
  except subprocess.CalledProcessError as e: