jin2li commited on
Commit
531499f
ยท
verified ยท
1 Parent(s): 78b05ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -0
app.py CHANGED
@@ -1110,6 +1110,63 @@ def evaluate_component_from_country_files_only(country, material, component, tar
1110
  return result
1111
 
1112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1113
  def process_single_ingredient(
1114
  countries,
1115
  single_query,
 
1110
  return result
1111
 
1112
 
1113
+
1114
+ def make_single_display_result(final_result, country_col="", component=None):
1115
+ """
1116
+ ๋‹จ์ผ ์„ฑ๋ถ„ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ ํ‘œ์˜ '๋ฐฐํ•ฉํ•œ๋„/๊ธˆ์ง€' ์นธ์— ๋“ค์–ด๊ฐˆ ์งง์€ ํ‘œ์‹œ๋ฌธ๊ตฌ๋ฅผ ๋งŒ๋“ ๋‹ค.
1117
+ """
1118
+ component = component or {}
1119
+
1120
+ result_text = safe_str(final_result.get("๊ฒฐ๊ณผ", ""))
1121
+ display_text = safe_str(final_result.get("ํ‘œ์‹œ๋ฌธ๊ตฌ", ""))
1122
+ inci_name = safe_str(component.get("INCI Name", ""))
1123
+
1124
+ if display_text:
1125
+ cleaned_display = normalize_formula_country_text(
1126
+ display_text,
1127
+ country_col=country_col,
1128
+ inci_name=inci_name,
1129
+ amount_text=safe_str(component.get("In formula(w/w %)", "")),
1130
+ )
1131
+
1132
+ if cleaned_display:
1133
+ return cleaned_display
1134
+
1135
+ cleaned_result = normalize_formula_country_text(
1136
+ result_text,
1137
+ country_col=country_col,
1138
+ inci_name=inci_name,
1139
+ amount_text=safe_str(component.get("In formula(w/w %)", "")),
1140
+ )
1141
+
1142
+ if cleaned_result:
1143
+ return cleaned_result
1144
+
1145
+ return NEED_CHECK_TEXT
1146
+
1147
+
1148
+ def simplify_single_note(note):
1149
+ """
1150
+ ๋‹จ์ผ ์„ฑ๋ถ„ ๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ์˜ ๋น„๊ณ ๋ฅผ ๋„ˆ๋ฌด ๊ธธ์ง€ ์•Š๊ฒŒ ์ •๋ฆฌํ•œ๋‹ค.
1151
+ """
1152
+ note = safe_str(note)
1153
+
1154
+ if not note or note == "-":
1155
+ return ""
1156
+
1157
+ replace_map = {
1158
+ "๋กœ์ปฌ ์ œํ•œ์„ฑ๋ถ„ ๋ชฉ๋ก์—๋Š” ์žˆ์œผ๋‚˜ ํ•ด๋‹น ๊ตญ๊ฐ€ ํ•œ๋„๊ฐ’ ๋ฏธ๋“ฑ๋ก. Pass ์ฒ˜๋ฆฌ ๊ธˆ์ง€.": "ํ•ด๋‹น ๊ตญ๊ฐ€ ํ•œ๋„๊ฐ’ ๋ฏธ๋“ฑ๋ก",
1159
+ "๊ณ ์œ„ํ—˜๊ตฐ ํ›„๋ณด ์„ฑ๋ถ„์ด๋ฏ€๋กœ ๊ทผ๊ฑฐ ๋ฏธ๊ฒ€์ถœ๋งŒ์œผ๋กœ Pass ์ฒ˜๋ฆฌํ•˜์ง€ ์•Š์Œ": "๊ทผ๊ฑฐ ๋ฏธ๊ฒ€์ถœ, ํ™•์ธ ํ•„์š”",
1160
+ "๊ณ ์œ„ํ—˜๊ตฐ ํ›„๋ณด์ด๋‚˜ ๊ตญ๊ฐ€๋ณ„ ๊ทœ์ œํŒŒ์ผ์—์„œ ์ง์ ‘ ๊ทผ๊ฑฐ ๋ฏธ๊ฒ€์ถœ. Pass ์ฒ˜๋ฆฌํ•˜์ง€ ์•Š์Œ.": "๊ตญ๊ฐ€๋ณ„ ๊ทœ์ œํŒŒ์ผ ๋‚ด ์ง์ ‘ ๊ทผ๊ฑฐ ๋ฏธ๊ฒ€์ถœ",
1161
+ "ํ•ด๋‹น ๊ตญ๊ฐ€/์ฑ„๋„ ๊ทœ์ œ DB ์—†์Œ. ๊ณ ์œ„ํ—˜๊ตฐ ํ›„๋ณด์ด๋ฏ€๋กœ Pass ์ฒ˜๋ฆฌํ•˜์ง€ ์•Š์Œ.": "ํ•ด๋‹น ๊ตญ๊ฐ€ ๊ทœ์ œ DB ์—†์Œ",
1162
+ "ํ–ฅ๋ฃŒ๋Š” ์„ธ๋ถ€ ๊ตฌ์„ฑ์„ฑ๋ถ„ ๋ฐ ์•Œ๋ ˆ๋ฅด๊ฒ ํ‘œ์‹œ๋Œ€์ƒ ์—ฌ๋ถ€ ํ™•์ธ ํ•„์š”. ์ž๋™ Pass ์ฒ˜๋ฆฌ ๊ธˆ์ง€.": "ํ–ฅ๋ฃŒ ์„ธ๋ถ€ ์กฐ์„ฑ ๋ฐ ์•Œ๋ ˆ๋ฅด๊ฒ ํ™•์ธ ํ•„์š”",
1163
+ "์ •์ œ์ˆ˜/Water/Aqua ๊ธฐ๋ณธ Pass ์ฒ˜๋ฆฌ": "์ •์ œ์ˆ˜/Water/Aqua ๊ธฐ๋ณธ Pass ์ฒ˜๋ฆฌ",
1164
+ "์ผ๋ณธ ์ˆ˜์ถœ์šฉ ์ œํ’ˆ ์‚ฌ์šฉ ๋ถˆ๊ฐ€ ์—ฌ๋ถ€ ํ™•์ธ ํ•„์š”": "์ผ๋ณธ ์ˆ˜์ถœ์šฉ ์ œํ’ˆ ์‚ฌ์šฉ ๋ถˆ๊ฐ€ ์—ฌ๋ถ€ ํ™•์ธ ํ•„์š”",
1165
+ }
1166
+
1167
+ return replace_map.get(note, note)
1168
+
1169
+
1170
  def process_single_ingredient(
1171
  countries,
1172
  single_query,