ssboost commited on
Commit
2bbc031
ยท
verified ยท
1 Parent(s): d5f7891

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -2
app.py CHANGED
@@ -214,9 +214,15 @@ def wrapper_modified(keyword, korean_only, apply_main_keyword_option, exclude_ze
214
 
215
  # API ์‘๋‹ต ํ™•์ธ ๋ฐ ์ฒ˜๋ฆฌ (6๊ฐœ ๊ฐ’)
216
  logger.info(f"API ์‘๋‹ต ํƒ€์ž…: {type(result)}, ๊ธธ์ด: {len(result) if isinstance(result, (list, tuple)) else 'N/A'}")
 
217
 
218
  if isinstance(result, (list, tuple)) and len(result) >= 6:
219
  table_html, cat_choices, vol_choices, selected_cat, download_file, extra = result[:6]
 
 
 
 
 
220
  elif isinstance(result, (list, tuple)) and len(result) >= 5:
221
  table_html, cat_choices, vol_choices, selected_cat, download_file = result[:5]
222
  extra = None
@@ -246,10 +252,18 @@ def wrapper_modified(keyword, korean_only, apply_main_keyword_option, exclude_ze
246
  elif isinstance(selected_cat, list):
247
  selected_cat = selected_cat[0] if selected_cat else "์ „์ฒด ๋ณด๊ธฐ"
248
 
 
 
 
 
249
  local_file = None
250
  if download_file:
251
- local_file = create_session_temp_file(session_id, '.xlsx')
252
- shutil.copy(download_file, local_file)
 
 
 
 
253
 
254
  return (
255
  gr.update(value=table_html),
@@ -265,6 +279,8 @@ def wrapper_modified(keyword, korean_only, apply_main_keyword_option, exclude_ze
265
 
266
  except Exception as e:
267
  logger.error(f"API ํ˜ธ์ถœ ์˜ค๋ฅ˜: {e}")
 
 
268
  return (
269
  gr.update(value="<p>๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ํ‚ค์›Œ๋“œ๋กœ ์‹œ๋„ํ•ด๋ณด์„ธ์š”.</p>"),
270
  gr.update(choices=["์ „์ฒด ๋ณด๊ธฐ"]),
 
214
 
215
  # API ์‘๋‹ต ํ™•์ธ ๋ฐ ์ฒ˜๋ฆฌ (6๊ฐœ ๊ฐ’)
216
  logger.info(f"API ์‘๋‹ต ํƒ€์ž…: {type(result)}, ๊ธธ์ด: {len(result) if isinstance(result, (list, tuple)) else 'N/A'}")
217
+ logger.info(f"API ์‘๋‹ต ๋‚ด์šฉ: {result}")
218
 
219
  if isinstance(result, (list, tuple)) and len(result) >= 6:
220
  table_html, cat_choices, vol_choices, selected_cat, download_file, extra = result[:6]
221
+ logger.info(f"table_html ํƒ€์ž…: {type(table_html)}")
222
+ logger.info(f"cat_choices: {cat_choices}")
223
+ logger.info(f"vol_choices: {vol_choices}")
224
+ logger.info(f"selected_cat: {selected_cat}")
225
+ logger.info(f"download_file: {download_file}")
226
  elif isinstance(result, (list, tuple)) and len(result) >= 5:
227
  table_html, cat_choices, vol_choices, selected_cat, download_file = result[:5]
228
  extra = None
 
252
  elif isinstance(selected_cat, list):
253
  selected_cat = selected_cat[0] if selected_cat else "์ „์ฒด ๋ณด๊ธฐ"
254
 
255
+ logger.info(f"์ฒ˜๋ฆฌ๋œ cat_choices: {cat_choices}")
256
+ logger.info(f"์ฒ˜๋ฆฌ๋œ vol_choices: {vol_choices}")
257
+ logger.info(f"์ฒ˜๋ฆฌ๋œ selected_cat: {selected_cat}")
258
+
259
  local_file = None
260
  if download_file:
261
+ try:
262
+ local_file = create_session_temp_file(session_id, '.xlsx')
263
+ shutil.copy(download_file, local_file)
264
+ logger.info(f"ํŒŒ์ผ ๋ณต์‚ฌ ์™„๋ฃŒ: {local_file}")
265
+ except Exception as file_error:
266
+ logger.error(f"ํŒŒ์ผ ๋ณต์‚ฌ ์˜ค๋ฅ˜: {file_error}")
267
 
268
  return (
269
  gr.update(value=table_html),
 
279
 
280
  except Exception as e:
281
  logger.error(f"API ํ˜ธ์ถœ ์˜ค๋ฅ˜: {e}")
282
+ import traceback
283
+ logger.error(f"์ƒ์„ธ ์˜ค๋ฅ˜: {traceback.format_exc()}")
284
  return (
285
  gr.update(value="<p>๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ํ‚ค์›Œ๋“œ๋กœ ์‹œ๋„ํ•ด๋ณด์„ธ์š”.</p>"),
286
  gr.update(choices=["์ „์ฒด ๋ณด๊ธฐ"]),