Jintonic92 commited on
Commit
f9765ef
·
verified ·
1 Parent(s): 92027e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -67,12 +67,18 @@ def load_question_generator():
67
  # CSV 데이터 로드 함수
68
  @st.cache_data
69
  #def load_data(data_file='/train.csv'):
70
- def load_data(data_file='/processed_mathqa2.csv'):
71
  try:
72
  file_path = os.path.join(data_path, data_file.lstrip('/'))
73
  df = pd.read_csv(file_path)
74
  logger.info(f"Data loaded successfully from {file_path}")
 
 
 
 
 
75
  return df
 
76
  except FileNotFoundError:
77
  st.error(f"파일을 찾을 수 없습니다: {data_file}")
78
  logger.error(f"File not found: {data_file}")
@@ -80,7 +86,10 @@ def load_data(data_file='/processed_mathqa2.csv'):
80
 
81
  def start_quiz():
82
  """퀴즈 시작 및 초기화"""
83
- df = load_data()
 
 
 
84
  if df is None or df.empty:
85
  st.error("데이터를 불러올 수 없습니다. 데이터셋을 확인해주세요.")
86
  return
 
67
  # CSV 데이터 로드 함수
68
  @st.cache_data
69
  #def load_data(data_file='/train.csv'):
70
+ def load_data(data_file='/processed_mathqa2.csv', selected_indexes=None):
71
  try:
72
  file_path = os.path.join(data_path, data_file.lstrip('/'))
73
  df = pd.read_csv(file_path)
74
  logger.info(f"Data loaded successfully from {file_path}")
75
+
76
+ if selected_indexes is not None:
77
+ df = df.loc[selected_indexes] # Filter rows by index
78
+ logger.info(f"Data filtered to selected indexes: {selected_indexes}")
79
+
80
  return df
81
+
82
  except FileNotFoundError:
83
  st.error(f"파일을 찾을 수 없습니다: {data_file}")
84
  logger.error(f"File not found: {data_file}")
 
86
 
87
  def start_quiz():
88
  """퀴즈 시작 및 초기화"""
89
+
90
+ selected_indexes = [6400, 24318, 18158, 6715, 21794, 7026, 3520, 7259, 7295, 7401]
91
+
92
+ df = load_data(selected_indexes=selected_indexes)
93
  if df is None or df.empty:
94
  st.error("데이터를 불러올 수 없습니다. 데이터셋을 확인해주세요.")
95
  return