Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
| 252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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=["์ ์ฒด ๋ณด๊ธฐ"]),
|