XufengDuan commited on
Commit
bf50951
1 Parent(s): 0aa8023

update scripts

Browse files
Files changed (1) hide show
  1. src/backend/model_operations.py +14 -8
src/backend/model_operations.py CHANGED
@@ -142,8 +142,10 @@ class SummaryGenerator:
142
  print(sheet_names)
143
 
144
  Experiment_ID, Questions_ID, Item_ID, Condition, User_prompt, Response, Factor_2, Stimuli_1 = [], [], [], [], [] ,[], [], []
145
-
146
- for i, sheet_name in enumerate(sheet_names, start=1):
 
 
147
  # 读取每个工作表
148
  # if i > 2 and i ==1:
149
  # continue
@@ -175,9 +177,10 @@ class SummaryGenerator:
175
  Stimuli_1_column = df_sheet["Stimuli-1"]
176
  if 'Stimuli-2' in df_sheet.columns:
177
  Stimuli_2_column = df_sheet["Stimuli-2"]
178
-
179
- # 遍历Prompt0列的值
180
- for j, prompt_value in enumerate(tqdm(prompt_column, desc=f"Processing {sheet_name}"), start=0):
 
181
  ID = 'E' + str(i)
182
  # q_ID = ID + '_' + str(j)
183
 
@@ -210,10 +213,13 @@ class SummaryGenerator:
210
  time.sleep(wait_time)
211
  else:
212
  print(f"Error at index {i}: {e}")
213
- wait_time = 60
214
  exceptions.append(i)
215
- time.sleep(wait_time)
216
- break
 
 
 
217
  if i == 5:
218
  print(_response)
219
 
 
142
  print(sheet_names)
143
 
144
  Experiment_ID, Questions_ID, Item_ID, Condition, User_prompt, Response, Factor_2, Stimuli_1 = [], [], [], [], [] ,[], [], []
145
+ exit_outer_loop = False # bad model
146
+ for i, sheet_name in enumerate(sheet_names, start=1):
147
+ if exit_outer_loop:
148
+ break
149
  # 读取每个工作表
150
  # if i > 2 and i ==1:
151
  # continue
 
177
  Stimuli_1_column = df_sheet["Stimuli-1"]
178
  if 'Stimuli-2' in df_sheet.columns:
179
  Stimuli_2_column = df_sheet["Stimuli-2"]
180
+
181
+ for j, prompt_value in enumerate(tqdm(prompt_column, desc=f"Processing {sheet_name}"), start=0):
182
+ if exit_outer_loop:
183
+ break
184
  ID = 'E' + str(i)
185
  # q_ID = ID + '_' + str(j)
186
 
 
213
  time.sleep(wait_time)
214
  else:
215
  print(f"Error at index {i}: {e}")
216
+ #wait_time = 60
217
  exceptions.append(i)
218
+ exit_outer_loop = True # 设置标志变量为True,准备退出最外层循环
219
+ break # 跳出当前的 while 循环
220
+
221
+ if exit_outer_loop:
222
+ break
223
  if i == 5:
224
  print(_response)
225