QIDNLF commited on
Commit
7003401
ยท
verified ยท
1 Parent(s): 38a2532

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -104,14 +104,21 @@ def update_category_dd(standard, version):
104
  for t in tables:
105
  if t == main_t:
106
  continue
107
- short_name = t.replace(f"{standard}_{version}_", "")
 
 
 
 
 
 
 
108
  choices.append(f"{short_name}")
109
 
110
  conn.close()
111
 
112
  except Exception as e:
113
- # ์—๋Ÿฌ ๋ฐœ์ƒ ์‹œ ์ฝ˜์†”์— ์ถœ๋ ฅํ•˜์—ฌ ๋””๋ฒ„๊น… ๊ฐ€๋Šฅํ•˜๊ฒŒ ์ˆ˜์ •
114
  print(f"[Error in update_category_dd] standard: {standard}, version: {version}")
 
115
  traceback.print_exc()
116
 
117
  return gr.Dropdown(choices=choices)
 
104
  for t in tables:
105
  if t == main_t:
106
  continue
107
+
108
+ # ๐Ÿš€ ์ˆ˜์ •๋œ ๋ถ€๋ถ„: ์ •๊ทœ์‹์„ ์‚ฌ์šฉํ•ด ๋Œ€์†Œ๋ฌธ์ž, ์–ธ๋”๋ฐ”(_), ๊ณต๋ฐฑ ๋ฌด์‹œํ•˜๊ณ  ์ ‘๋‘์‚ฌ ๊น”๋”ํ•˜๊ฒŒ ์ œ๊ฑฐ
109
+ prefix_pattern = f"^{standard}[_\\s-]*{version}[_\\s-]*"
110
+ short_name = re.sub(prefix_pattern, "", t, flags=re.IGNORECASE)
111
+
112
+ # ๋งŒ์•ฝ ํ…Œ์ด๋ธ” ์ด๋ฆ„์— ๋‚จ์€ ํŠน์ˆ˜๋ฌธ์ž๋‚˜ ๊ณต๋ฐฑ์ด ๋ณด๊ธฐ ์‹ซ๋‹ค๋ฉด ํ•œ ๋ฒˆ ๋” ์ •๋ฆฌ
113
+ short_name = short_name.strip()
114
+
115
  choices.append(f"{short_name}")
116
 
117
  conn.close()
118
 
119
  except Exception as e:
 
120
  print(f"[Error in update_category_dd] standard: {standard}, version: {version}")
121
+ import traceback
122
  traceback.print_exc()
123
 
124
  return gr.Dropdown(choices=choices)