Corin1998 commited on
Commit
5c349c2
·
verified ·
1 Parent(s): 673fd40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -7,6 +7,17 @@ from dotenv import load_dotenv
7
 
8
  load_dotenv()
9
 
 
 
 
 
 
 
 
 
 
 
 
10
  # ========= 画面から見られる簡易ログ =========
11
  _APP_LOG = io.StringIO()
12
  def _log(msg: str):
@@ -45,10 +56,10 @@ def ui_company_score_and_proposal(company_name,
45
  return "### ❌ 初期化エラー\n```\n" + tb + "\n```"
46
 
47
  urls = [u.strip() for u in (urls_text or "").splitlines() if u.strip()]
48
- # gr.File or str のどちらでも拾えるように安全化
 
49
  try:
50
  iterable = files or []
51
- # Gradio の multiple=False のときに単体で来た場合に備える
52
  if not isinstance(iterable, (list, tuple)):
53
  iterable = [iterable]
54
  file_paths = [getattr(f, "name", str(f)) for f in iterable if f]
 
7
 
8
  load_dotenv()
9
 
10
+ # ---- Gradio の API スキーマ生成を無効化して 500 を回避(既知バグ対策)----
11
+ try:
12
+ import gradio.blocks as _gr_blocks
13
+ def _no_api_info(self):
14
+ # API 情報は不要なので空を返す(UI には影響なし)
15
+ return {}
16
+ _gr_blocks.Blocks.get_api_info = _no_api_info
17
+ except Exception as _e:
18
+ print("[warn] failed to patch gradio Blocks.get_api_info:", _e, flush=True)
19
+ # -------------------------------------------------------------------------
20
+
21
  # ========= 画面から見られる簡易ログ =========
22
  _APP_LOG = io.StringIO()
23
  def _log(msg: str):
 
56
  return "### ❌ 初期化エラー\n```\n" + tb + "\n```"
57
 
58
  urls = [u.strip() for u in (urls_text or "").splitlines() if u.strip()]
59
+
60
+ # gr.File or str のどちらでも拾えるように安全化(multiple=False も考慮)
61
  try:
62
  iterable = files or []
 
63
  if not isinstance(iterable, (list, tuple)):
64
  iterable = [iterable]
65
  file_paths = [getattr(f, "name", str(f)) for f in iterable if f]