Spaces:
Sleeping
Sleeping
remove timeout
Browse files
app.py
CHANGED
@@ -244,19 +244,6 @@ def check_csv_and_run(file, key):
|
|
244 |
except Exception as e:
|
245 |
return pd.DataFrame([{"錯誤訊息": f"評估失敗:{str(e)}"}]), None
|
246 |
|
247 |
-
# 需要等待時間大於2小時時自動取消評估
|
248 |
-
def check_csv_and_run_with_timeout(file, key):
|
249 |
-
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor:
|
250 |
-
future = executor.submit(check_csv_and_run, file, key,)
|
251 |
-
try:
|
252 |
-
return future.result(timeout=2 * 60 * 60)
|
253 |
-
except concurrent.futures.TimeoutError:
|
254 |
-
print("任務超時:已達 2 小時上限")
|
255 |
-
return pd.DataFrame([{"錯誤訊息": "⚠️ 需要等待的時間過長,已自動取消評估,建議改用其他分流進行評估。"}]), None
|
256 |
-
except Exception as e:
|
257 |
-
print("執行緒任務錯誤:", e)
|
258 |
-
return pd.DataFrame([{"錯誤訊息": f"系統錯誤:{str(e)}"}]), None
|
259 |
-
|
260 |
# Gradio 介面
|
261 |
with gr.Blocks() as demo:
|
262 |
gr.Markdown("""
|
|
|
244 |
except Exception as e:
|
245 |
return pd.DataFrame([{"錯誤訊息": f"評估失敗:{str(e)}"}]), None
|
246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
# Gradio 介面
|
248 |
with gr.Blocks() as demo:
|
249 |
gr.Markdown("""
|