Spaces:
Running
Running
Update app.py
Browse files21 unmodified lines2223242526272825292627287 unmodified lines3637384339404119 unmodified lines61626369646566736775767778796869708171727374868788897576779091789379808111 unmodified lines939495111969798115116117991181001011021031041241251051261061071089 unmodified lines1181191201421211221236 unmodified lines13013113213313413513613713813914014114214312 unmodified lines1561571581731741751761771591781601611621631641651851861661671881891681691701711721731741751761771781791801811911921931941951821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122139 unmodified lines2232242252262272282292132142152302312322332342352 unmodified lines2382392402242252412422432442292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582452462472602612622632642652662672482492502512522532692702712722732742752762772782792802812822832842852862542552562572582592602612622634 unmodified lines2682692702972712993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563572722732745 unmodified lines2802812823692832843723733743753763772852862873802883822892902912 unmodified lines29429529639129729829930039630130239830330440030530630740430830940740840941041141241331031131231331431531631731831932032132241541641741841942042142242342442542642742842932332432532632743143243332832943543643743843944033033133233344244344444544644744844945033433545245345445545645733633733833934034134234346334434534634721 unmodified lines
dict_path = "custom_dict.json"
# =====================================================================# โ
AI ์๋ ๋ณต๊ตฌ & ๋ณํฉ ๋ก์ง (๊ธฐ์กด ์๋ฒฝ ์ ์ง) โ
# =====================================================================AUTO_MERGE_WORDS = [["GS๋ง์ด์ต", "์ง์์ค๋ง์ด์ต"],["์ง์์ค ๋ง์ด์ต", "์ง์์ค ๋ง์ด์ต"],["1+1", "์ํ๋ฌ์ค์"],["2+1", "ํฌํ๋ฌ์ค์"],["F/W", "์ํ ๋๋ธ์ "],["S/S", "์์ค ์์ค"],["VIP", "๋ธ์ด์์ดํผ"],["ํ ์ธ๊ฐ", "ํ๋ฆฐ๊น"],["ํน๊ฐ", "ํน๊น"],["์ต์ ๊ฐ", "์ต์ ๊น"],["๋จ๋
๊ตฌ์ฑ", "๋จ๋
๊พธ์ฑ"],["์ญ๋๊ธ", "์ญ๋๋"],["์ฑ๊ฒฐ์ ", "์ฑ๊ปผ์ "],["์ผ์๋ถ", "์ผ์จ๋ถ"],["๋ฌด์ด์", "๋ฌด์ด์"],["๋งค์ง์๋ฐ", "๋งค์ง๋๋ฐ"],["์๋์ฃผ๋ฌธ", "์๋์ฃผ๋ฌธ"],["์ฌ์ํ", "์ฌ์ํ"],["ํ๋ฆฌํฐ๋ฅผ", "ํ๋ฆฌํฐ๋ฅผ"],["๋ํ
์ผ์ด", "๋ํ
์ด๋ฆฌ"],["์ค๋ฃจ์ฃ์ด", "์ค๋ฃจ์์"],["์ปคํฐ์ค๋ฒ
", "์ปคํฐ์ค๋ฒ
"],["์ธ๋ฅด์ฆ๋ธ๋์ฝ", "์ธ๋ฅด์ฆ๋ธ๋์ฝ"],["ํฌ๋จธํฐ๋ธ", "ํฌ๋จธํฐ๋ธ"],["๋นํธ๋ฆด", "๋นํธ๋ฆด"],["๋ ๋ฏธ์ค๋ฅด๋ฃจ", "๋ ๋ฏธ์ค๋ฅด๋ฃจ"],["์ญ๋ํด๋ผ์ฐ์ค", "์๋ํด๋ผ์ฐ์ค"],["ํธ๋ง๊ณจํ", "ํธ๋ง๊ณจํ"],["์ปฌ๋ผ๋น์", "์ปฌ๋ผ๋น์"],["์์ค๊น๋ค์คํฌ์ธ ", "์์ค๊น๋ค์คํฌ์ธ "],["์์ค์นด๋ค์คํฌ์ธ ", "์์ค๊น๋ค์คํฌ์ธ "],["์์ธ", "์์ธ"],["์๋ํ๋", "์๋ํ๋"],["๋ผ์์ํ", "๋ผ์์ํ"],["๋ชจ๋ฅด๊ฐ", "๋ชจ๋ฅด๊ฐ"],["๋ง์ค์คํ๋์ค", "๋ง์ฐ์คํ๋์ค"],["๋ฐ์ผ๋ฆฌ๋ธ๋ฃจ", "๋ฐ์ผ๋ฆฌ๋ธ๋ฃจ"],["ํธ๋ผ์ด์ํ", "ํธ๋ผ์ด์ํ"],["์์จ๋น ํด๋กํด๋ฝ", "์์จ๋น ํด๋กํด๋ฝ"],["๊ธฐํ ", "๊ธฐํ "],["์ค๋ก ๋", "์ค๋ก ๋"],["SJ์๋", "์์ค์ ์ด์๋"],["์ฝ์ด ์ด์ผํฑ", "์ฝ์ด ์ด์ผํฑ"],["๋ฅด๋คํฌ๋ฃจ", "๋ฅด๋คํฌ๋ฃจ"],["๋ํ", "๋ํ"],["1์ข
", "์ผ์ข
"],["2์ข
", "์ด์ข
"],["3์ข
", "์ผ์ข
"],["4์ข
", "์ฌ์ข
"],["5์ข
", "์ค์ข
"],["10์ข
", "์ญ์ข
"],["4in1", "ํฌ์ธ์"],["25FW", "์ด์ค ์ํ ๋๋ธ์ "],["25 F/W", "์ด์ค ์ํ ๋๋ธ์ "],["์ด์ค ์ํ๋ ๋ธ์ ", "์ด์ค ์ํ ๋๋ธ์ "],["26SS", "์ด์ญ๋ต์์ค์์ค"],["2026 SS", "์ด์ฒ์ด์ญ๋ต ์์ค์์ค"],["SS์์ฆ", "์์ค์์ค ์์ฆ"],["์
์
", "์ธ๋ฅ"],["๋ฆฌ๋ฒ์๋ธ", "๋ฆฌ๋ฒ์๋ธ"],["๋งจํฌ๋งจ", "๋งจํฌ๋งจ"],["์ํฐํฌ์ธ ", "์ํฐํฌ์ธ "],["๋ณธ๋ฉํฌ์ธ ", "๋ณธ๋ฉํฌ์ธ "],["์ค์์์ผ", "์ค์์์ผ"],["ํ์ด๋ธ๋ฆฌ๋", "ํ์ด๋ธ๋ฆฌ๋"],["๋ ์ด์ด๋ง", "๋ ์ด์ด๋ง"],["๋ ์ด์ด๋", "๋ ์ด์ด๋"],["์์นด๋ผ", "์์นด๋ผ"],["์ธํ์ค", "์ธํ์ค"],["๋๋ค์ดํจ๋ฉ", "๋๋ฐ์ดํจ๋ฉ"],["๋๋ค์ด์ค์ปคํธ", "๋๋ฐ์ด์ค์ปคํธ"],["๊ทธ๋ ์ด์ง", "๊ทธ๋ ์ด์ง"],["ํธ์", "ํธ์"],["ํ๊ฐ๋จผํธ", "ํ๊ฐ๋จผํธ"],["ํ๋ฌํผ", "ํ๋ฌํผ"],["๋
ธ๋ฅด๋", "๋
ธ๋ฅด๋"],["์ธ๋ธ๋ ๋", "์ธ๋ธ๋ ๋"],["๋ผ์ฟค ๋ธ๋ ๋", "๋ผ์ฟค ๋ธ๋ ๋"],["์ธ์ด์ง๊ทธ๋ฆฐ", "์ธ์ด์ง๊ทธ๋ฆฐ"],["๋ชจ๋ธ์์ธ", "๋ชจ๋ธ์์ธ"],["ํฌ๋ก์", "ํฌ๋ก์
ฐ"],["๋ ์ด์ค ํจ์ง", "๋ ์ด์ค ํจ์ง"],["์์ด์์ปค", "์์ด์์ปค"],["ํธ๋ ์คํ์ผ๋ฌ", "ํธ๋ ์คํ์ผ๋ฌ"],["์์ผ๋ ", "์์ผ๋ "],["์์ด ๋ธ๋ ์ด์ ", "์์ด ๋ธ๋ ์ด์ "],["ํธ๋ธ๋ฃจ", "ํธ๋ธ๋ฃจ"],["์์ด๋ฆฌ", "์์ด๋ฆฌ"],["ํํฑ", "ํํฑ"],["์ฌ๋ฆฌ๋ธ๋ฆฌ์ค", "์ฌ๋ฆฌ๋ธ๋ฆฌ์ค"],["ํค ๋ ์ด์ด๋", "ํค ๋ ์ด์ด๋"],["์ฌํฐ", "์ฌํฐ"],["์ํฌ๋ธ๋", "์ํฌ๋ธ๋"],["์ธ๋จธ๋ธ๋ผ์ด", "์ธ๋จธ๋ธ๋ผ์ด"],["๋ธ๋ฃธํํฌ", "๋ธ๋ฃธํํฌ"],["๋ฏธ์คํธ๋ธ๋ฃจ", "๋ฏธ์คํธ๋ธ๋ฃจ"],["๋ฅด๋ค๋ฒ ์ด์ง", "๋ฅด๋ค๋ฒ ์ด์ง"],["์ธ๋จธ์นดํค", "์ธ๋จธ์นดํค"],["์ธํผ๋ํฐ๋ธ๋ฃจ", "์ธํผ๋ํฐ๋ธ๋ฃจ"],["๋ฅด๋ค๋ธ๋", "๋ฅด๋ค๋ธ๋"],["๋ธ๋ฃธํ์ดํธ", "๋ธ๋ฃธํ์ดํธ"],["์ธ๋จธ๋ค์ด๋น", "์ธ๋จธ๋ค์ด๋น"],["๋ธ๋ผ์ธํํฌ", "๋ธ๋ผ์ธํํฌ"],["์ธ๋จธ๋ฒ ์ด์ง", "์ธ๋จธ๋ฒ ์ด์ง"],["๋ฅ์์ธ", "๋ฅ์์ธ"],["100ํ๋ก", "๋ฐฑํ๋ก"],["100%", "๋ฐฑํ๋ก"],["86%", "ํ์ญ์กํ๋ก"],["14%", "์ญ์ฌํ๋ก"],["1,499,900์", "๋ฐฑ์ฌ์ญ๊ตฌ๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["169,900์", "์ญ์ก๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["159,900์", "์ญ์ค๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["149,000์", "์ญ์ฌ๋ง ๊ตฌ์ฒ ์"],["12๋ง 9์ฒ 8๋ฐฑ ์", "์ญ์ด๋ง ๊ตฌ์ฒํ๋ฐฑ ์"],["10๋ง 9์ฒ์", "์ญ๋ง ๊ตฌ์ฒ์"],["89,900์", "ํ๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["79,900์", "์น ๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["79,900 ์", "์น ๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["6๋ง 9์ฒ 9๋ฐฑ ์", "์ก๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["69,900์", "์ก๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["69,900 ์", "์ก๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["3๋ง 6์ฒ์๋", "์ผ๋ง ์ก์ฒ์๋"]AUTO_MERGE_WORDS = [["GS๋ง์ด์ต", "์ง์์ค๋ง์ด์ต"],["์ง์์ค ๋ง์ด์ต", "์ง์์ค ๋ง์ด์ต"],["1+1", "์ํ๋ฌ์ค์"],["2+1", "ํฌํ๋ฌ์ค์"],["F/W", "์ํ ๋๋ธ์ "],["S/S", "์์ค ์์ค"],["VIP", "๋ธ์ด์์ดํผ"],["ํ ์ธ๊ฐ", "ํ๋ฆฐ๊น"],["ํน๊ฐ", "ํน๊น"],["์ต์ ๊ฐ", "์ต์ ๊น"],["๋จ๋
๊ตฌ์ฑ", "๋จ๋
๊พธ์ฑ"],["์ญ๋๊ธ", "์ญ๋๋"],["์ฑ๊ฒฐ์ ", "์ฑ๊ปผ์ "],["์ผ์๋ถ", "์ผ์จ๋ถ"],["๋ฌด์ด์", "๋ฌด์ด์"],["๋งค์ง์๋ฐ", "๋งค์ง๋๋ฐ"],["์๋์ฃผ๋ฌธ", "์๋์ฃผ๋ฌธ"],["์ฌ์ํ", "์ฌ์ํ"],["ํ๋ฆฌํฐ๋ฅผ", "ํ๋ฆฌํฐ๋ฅผ"],["๋ํ
์ผ์ด", "๋ํ
์ด๋ฆฌ"],["์ค๋ฃจ์ฃ์ด", "์ค๋ฃจ์์"],["์ปคํฐ์ค๋ฒ
", "์ปคํฐ์ค๋ฒ
"],["์ธ๋ฅด์ฆ๋ธ๋์ฝ", "์ธ๋ฅด์ฆ๋ธ๋์ฝ"],["ํฌ๋จธํฐ๋ธ", "ํฌ๋จธํฐ๋ธ"],["๋นํธ๋ฆด", "๋นํธ๋ฆด"],["๋ ๋ฏธ์ค๋ฅด๋ฃจ", "๋ ๋ฏธ์ค๋ฅด๋ฃจ"],["์ญ๋ํด๋ผ์ฐ์ค", "์๋ํด๋ผ์ฐ์ค"],["ํธ๋ง๊ณจํ", "ํธ๋ง๊ณจํ"],["์ปฌ๋ผ๋น์", "์ปฌ๋ผ๋น์"],["์์ค๊น๋ค์คํฌ์ธ ", "์์ค๊น๋ค์คํฌ์ธ "],["์์ค์นด๋ค์คํฌ์ธ ", "์์ค๊น๋ค์คํฌ์ธ "],["์์ธ", "์์ธ"],["์๋ํ๋", "์๋ํ๋"],["๋ผ์์ํ", "๋ผ์์ํ"],["๋ชจ๋ฅด๊ฐ", "๋ชจ๋ฅด๊ฐ"],["๋ง์ค์คํ๋์ค", "๋ง์ฐ์คํ๋์ค"],["๋ฐ์ผ๋ฆฌ๋ธ๋ฃจ", "๋ฐ์ผ๋ฆฌ๋ธ๋ฃจ"],["ํธ๋ผ์ด์ํ", "ํธ๋ผ์ด์ํ"],["์์จ๋น ํด๋กํด๋ฝ", "์์จ๋น ํด๋กํด๋ฝ"],["๊ธฐํ ", "๊ธฐํ "],["์ค๋ก ๋", "์ค๋ก ๋"],["SJ์๋", "์์ค์ ์ด์๋"],["์ฝ์ด ์ด์ผํฑ", "์ฝ์ด ์ด์ผํฑ"],["๋ฅด๋คํฌ๋ฃจ", "๋ฅด๋คํฌ๋ฃจ"],["๋ํ", "๋ํ"],["1์ข
", "์ผ์ข
"],["2์ข
", "์ด์ข
"],["3์ข
", "์ผ์ข
"],["4์ข
", "์ฌ์ข
"],["5์ข
", "์ค์ข
"],["10์ข
", "์ญ์ข
"],["4in1", "ํฌ์ธ์"],["25FW", "์ด์ค ์ํ ๋๋ธ์ "],["25 F/W", "์ด์ค ์ํ ๋๋ธ์ "],["์ด์ค ์ํ๋ ๋ธ์ ", "์ด์ค ์ํ ๋๋ธ์ "],["26SS", "์ด์ญ๋ต์์ค์์ค"],["2026 SS", "์ด์ฒ์ด์ญ๋ต ์์ค์์ค"],["SS์์ฆ", "์์ค์์ค ์์ฆ"],["์
์
", "์ธ๋ฅ"],["๋ฆฌ๋ฒ์๋ธ", "๋ฆฌ๋ฒ์๋ธ"],["๋งจํฌ๋งจ", "๋งจํฌ๋งจ"],["์ํฐํฌ์ธ ", "์ํฐํฌ์ธ "],["๋ณธ๋ฉํฌ์ธ ", "๋ณธ๋ฉํฌ์ธ "],["์ค์์์ผ", "์ค์์์ผ"],["ํ์ด๋ธ๋ฆฌ๋", "ํ์ด๋ธ๋ฆฌ๋"],["๋ ์ด์ด๋ง", "๋ ์ด์ด๋ง"],["๋ ์ด์ด๋", "๋ ์ด์ด๋"],["์์นด๋ผ", "์์นด๋ผ"],["์ธํ์ค", "์ธํ์ค"],["๋๋ค์ดํจ๋ฉ", "๋๋ฐ์ดํจ๋ฉ"],["๋๋ค์ด์ค์ปคํธ", "๋๋ฐ์ด์ค์ปคํธ"],["๊ทธ๋ ์ด์ง", "๊ทธ๋ ์ด์ง"],["ํธ์", "ํธ์"],["ํ๊ฐ๋จผํธ", "ํ๊ฐ๋จผํธ"],["ํ๋ฌํผ", "ํ๋ฌํผ"],["๋
ธ๋ฅด๋", "๋
ธ๋ฅด๋"],["์ธ๋ธ๋ ๋", "์ธ๋ธ๋ ๋"],["๋ผ์ฟค ๋ธ๋ ๋", "๋ผ์ฟค ๋ธ๋ ๋"],["์ธ์ด์ง๊ทธ๋ฆฐ", "์ธ์ด์ง๊ทธ๋ฆฐ"],["๋ชจ๋ธ์์ธ", "๋ชจ๋ธ์์ธ"],["ํฌ๋ก์", "ํฌ๋ก์
ฐ"],["๋ ์ด์ค ํจ์ง", "๋ ์ด์ค ํจ์ง"],["์์ด์์ปค", "์์ด์์ปค"],["ํธ๋ ์คํ์ผ๋ฌ", "ํธ๋ ์คํ์ผ๋ฌ"],["์์ผ๋ ", "์์ผ๋ "],["์์ด ๋ธ๋ ์ด์ ", "์์ด ๋ธ๋ ์ด์ "],["ํธ๋ธ๋ฃจ", "ํธ๋ธ๋ฃจ"],["์์ด๋ฆฌ", "์์ด๋ฆฌ"],["ํํฑ", "ํํฑ"],["์ฌ๋ฆฌ๋ธ๋ฆฌ์ค", "์ฌ๋ฆฌ๋ธ๋ฆฌ์ค"],["ํค ๋ ์ด์ด๋", "ํค ๋ ์ด์ด๋"],["์ฌํฐ", "์ฌํฐ"],["์ํฌ๋ธ๋", "์ํฌ๋ธ๋"],["์ธ๋จธ๋ธ๋ผ์ด", "์ธ๋จธ๋ธ๋ผ์ด"],["๋ธ๋ฃธํํฌ", "๋ธ๋ฃธํํฌ"],["๋ฏธ์คํธ๋ธ๋ฃจ", "๋ฏธ์คํธ๋ธ๋ฃจ"],["๋ฅด๋ค๋ฒ ์ด์ง", "๋ฅด๋ค๋ฒ ์ด์ง"],["์ธ๋จธ์นดํค", "์ธ๋จธ์นดํค"],["์ธํผ๋ํฐ๋ธ๋ฃจ", "์ธํผ๋ํฐ๋ธ๋ฃจ"],["๋ฅด๋ค๋ธ๋", "๋ฅด๋ค๋ธ๋"],["๋ธ๋ฃธํ์ดํธ", "๋ธ๋ฃธํ์ดํธ"],["์ธ๋จธ๋ค์ด๋น", "์ธ๋จธ๋ค์ด๋น"],["๋ธ๋ผ์ธํํฌ", "๋ธ๋ผ์ธํํฌ"],["์ธ๋จธ๋ฒ ์ด์ง", "์ธ๋จธ๋ฒ ์ด์ง"],["๋ฅ์์ธ", "๋ฅ์์ธ"],["100ํ๋ก", "๋ฐฑํ๋ก"],["100%", "๋ฐฑํ๋ก"],["86%", "ํ์ญ์กํ๋ก"],["14%", "์ญ์ฌํ๋ก"],["1,499,900์", "๋ฐฑ์ฌ์ญ๊ตฌ๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["169,900์", "์ญ์ก๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["159,900์", "์ญ์ค๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["149,000์", "์ญ์ฌ๋ง ๊ตฌ์ฒ ์"],["12๋ง 9์ฒ 8๋ฐฑ ์", "์ญ์ด๋ง ๊ตฌ์ฒํ๋ฐฑ ์"],["10๋ง 9์ฒ์", "์ญ๋ง ๊ตฌ์ฒ์"],["89,900์", "ํ๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["79,900์", "์น ๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["79,900 ์", "์น ๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["6๋ง 9์ฒ 9๋ฐฑ ์", "์ก๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["69,900์", "์ก๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["69,900 ์", "์ก๋ง ๊ตฌ์ฒ๊ตฌ๋ฐฑ ์"],["3๋ง 6์ฒ์๋", "์ผ๋ง ์ก์ฒ์๋"]]]
def perform_auto_recovery_and_merge(): if not os.path.exists(dict_path):7 unmodified lines existing_data = {"items":[], "meta": {"count": 0}} dict_map = {item[0].strip(): item[1].strip() for item in existing_data.get("items",[]) if len(item) == 2} for w in AUTO_MERGE_WORDS: dict_map[w[0]] = w[1] 19 unmodified lines pass return flat_dict
# ์๋ก ์ถ๊ฐ๋ AI ๊ฐ๋ ์กฐ์ ๋ก์งdef apply_g2p(text, mode): if g2p is None or mode == "๋๊ธฐ (์๋ ์ฌ์ ๋ง ์ ์ฉ)": return text if mode == "๋งค์ด ๋ง (๋ฌธ์ฅ ํต์งธ๋ก - ์์ฐ์ค๋ฌ์ด ์ฐ์)": try: return g2p(text) except: return text try: return g2p(text) except: return text if mode == "์ํ ๋ง (๋จ์ด๋ณ ๋๊ธฐ - ๊ณผ๋ํ ์ฐ์ ๋ฐฉ์ง)": # ๋์ด์ฐ๊ธฐ ๊ธฐ์ค์ผ๋ก ํ
์คํธ๋ฅผ ๋๋์ด ๊ฐ๋ณ ๋ณํ ํ ๋ค์ ํฉ์นจ words = re.split(r'(\s+)', text) res =[] for w in words: if w.strip(): try: res.append(g2p(w)) except: res.append(w) try: res.append(g2p(w)) except: res.append(w) else: res.append(w) else: res.append(w) return "".join(res) return text
def process_text(input_text, ai_mode, auto_break, font_size):11 unmodified lines parts =[] last_end = 0 for match in pattern.finditer(input_text): start, end = match.span() chunk = input_text[last_end:start] if chunk: parts.append(apply_g2p(chunk, ai_mode)) if chunk: parts.append(apply_g2p(chunk, ai_mode)) matched_word = match.group() parts.append(flat_dict[matched_word]) last_end = end tail = input_text[last_end:] if tail: parts.append(apply_g2p(tail, ai_mode)) if tail: parts.append(apply_g2p(tail, ai_mode)) final_text = "".join(parts)
if auto_break:9 unmodified lines html_parts.append(f'<span style="background-color: #ffe066; font-weight: bold; padding: 2px; border-radius: 3px; color: #000;">{chunk}</span>') html_output = f'<div id="prompter_label_space">๐บ ํ๋กฌํํฐ ๋ทฐ (๋ณ๊ฒฝ์ ํ์ธ)</div><div id="prompter_output_div" style="font-size:{font_size}px;">{"".join(html_parts)}</div>' return final_text, html_output, char_count
def clear_all():6 unmodified lines word = word.strip() pronun = pronun.strip() # โ
1๊ธ์ ๋ฑ๋ก ์์ฒ ์ฐจ๋จ (์๋ณธ ํผ์ ๋ฐฉ์ง) โ
if len(word) == 1: error_msg = f"๐ซ [๋ฑ๋ก ์คํจ] '{word}'์ฒ๋ผ 1๊ธ์๋ง ๋ฑ๋กํ๋ฉด ์๋ณธ์ด ํผ์๋ฉ๋๋ค! 2๊ธ์ ์ด์์ผ๋ก ๋ฑ๋กํด์ฃผ์ธ์." if current_input and current_input.strip(): final_text, html_output, char_count = process_text(current_input, ai_mode, auto_break, font_size) return error_msg, final_text, html_output, char_count return error_msg, "", "", "์
๋ ฅ ๊ธ์ ์: 0์" try: with open(dict_path, "r", encoding="utf-8") as f: j_struct = json.load(f)12 unmodified lines try: with open(dict_path, "w", encoding="utf-8") as f: json.dump(j_struct, f, ensure_ascii=False, indent=2) if current_input and word not in current_input: status_msg = f"โ ๏ธ ์ฌ์ ์ ์ฅ ์๋ฃ! ํ์ง๋ง ์๋ณธ ํ
์คํธ์ '{word}'(์ด)๊ฐ ์์ด ํ๋ฉด์ ๋ณํ๊ฐ ์์ต๋๋ค." else: status_msg = f"โ
'{word}' -> '{pronun}' ์ ์ฅ ๋ฐ ์ฆ์ ์ฌ๋ณํ ์ ์ฉ ์๋ฃ!" status_msg = f"โ
'{word}' -> '{pronun}' ์ ์ฅ ์๋ฃ!" except Exception as e: status_msg = f"โ ์ ์ฅ ์คํจ: {e}"
if current_input and current_input.strip(): final_text, html_output, char_count = process_text(current_input, ai_mode, auto_break, font_size) return status_msg, final_text, html_output, char_count else: return status_msg, "", "", "์
๋ ฅ ๊ธ์ ์: 0์" return status_msg, "", "", "์
๋ ฅ ๊ธ์ ์: 0์"
def get_file(): return dict_path if os.path.exists(dict_path) else None# ==========================================# โ
์๋ก ์ถ๊ฐ๋ ์ฌ์ ์ง์ ์กฐํ & ์์ ๊ธฐ๋ฅ โ
# ==========================================def load_current_json_to_text(): try: with open(dict_path, "r", encoding="utf-8") as f: data = json.load(f) # ๋์
๋๋ฆฌ ํํ๋ก ๋ณด๊ธฐ ์ข๊ฒ ๋ณํ dict_map = {item[0]: item[1] for item in data.get("items",[]) if len(item) == 2} pretty_json = json.dumps({"items": dict_map}, ensure_ascii=False, indent=4) return pretty_json, "โ
ํ์ฌ ์ฌ์ ์ ์ฑ๊ณต์ ์ผ๋ก ๋ถ๋ฌ์์ต๋๋ค! ์ด์ํ ๋จ์ด๋ฅผ ์ง์ฐ๊ฑฐ๋ ์์ ํด๋ณด์ธ์." except Exception as e: return "", f"โ ๋ถ๋ฌ์ค๊ธฐ ์คํจ: {e}"
def upload_file(file_path): if file_path is not None: shutil.copy(file_path, dict_path) return "โ
ํ์ผ ๋ณต๊ตฌ ์๋ฃ!" return "โ ๏ธ ํ์ผ์ด ์์ต๋๋ค."def overwrite_json_text(json_string): if not json_string or not json_string.strip(): return "โ ๏ธ ๋ด์ฉ์ ์
๋ ฅํด์ฃผ์ธ์." try: new_data = json.loads(json_string) if "items" not in new_data: return "โ ๏ธ ์ฌ๋ฐ๋ฅธ ์ฌ์ ํ์์ด ์๋๋๋ค. ('items' ํค๊ฐ ์์ต๋๋ค)" # ๋์
๋๋ฆฌ ํํ {"์ด": "์ข
"} ์ธ์ง ๋ฆฌ์คํธ ํํ [["์ด", "์ข
"]] ์ธ์ง ๋ชจ๋ ๋์ new_items = [] if isinstance(new_data["items"], dict): for k, v in new_data["items"].items(): new_items.append([k.strip(), v.strip()]) elif isinstance(new_data["items"], list): for item in new_data["items"]: if len(item) == 2: new_items.append([item[0].strip(), item[1].strip()])
final_data = {"items": new_items, "meta": {"count": len(new_items)}} with open(dict_path, "w", encoding="utf-8") as f: json.dump(final_data, f, ensure_ascii=False, indent=2) return f"๐จ [๋ฎ์ด์ฐ๊ธฐ ์๋ฃ] ์์ ํ ๋ด์ฉ({len(new_items)}๊ฐ)์ผ๋ก ์ฌ์ ์ ์๋ฒฝํ ๊ต์ฒดํ์ต๋๋ค! ์ด์ ๋ณํํด๋ณด์ธ์." except Exception as e: return f"โ JSON ํ์ฑ ์๋ฌ (๋ฐ์ดํ๋ ์ผํ๊ฐ ๋น ์ก๋์ง ํ์ธํ์ธ์): {e}"
def apply_json_text(json_string): # ๊ธฐ์กด ํ๋ฌ์ค(+) ๊ธฐ๋ฅ ์ ์ง if not json_string or not json_string.strip(): return "โ ๏ธ ๋ด์ฉ์ ์
๋ ฅํด์ฃผ์ธ์." try:9 unmodified lines dict_map = {item[0].strip(): item[1].strip() for item in existing_data.get("items",[]) if len(item) == 2} if isinstance(new_data["items"], dict): for k, v in new_data["items"].items(): dict_map[k.strip()] = v.strip() elif isinstance(new_data["items"], list): for item in new_data.get("items",[]): if len(item) == 2: dict_map[item[0].strip()] = item[1].strip() for item in new_data["items"]: if len(item) == 2: dict_map[item[0].strip()] = item[1].strip() merged_items = [[k, v] for k, v in dict_map.items()] existing_data["items"] = merged_items2 unmodified lines with open(dict_path, "w", encoding="utf-8") as f: json.dump(existing_data, f, ensure_ascii=False, indent=2) return f"โ
๊ธฐ์กด ๋จ์ด๋ฅผ ์ ์งํ๋ฉฐ {len(new_data.get('items',[]))}๊ฐ์ ๋จ์ด๋ฅผ ์ฑ๊ณต์ ์ผ๋ก ํ๋ฌ์ค(+) ํ์ต๋๋ค!" return f"โ
๊ธฐ์กด ๋จ์ด๋ฅผ ์ ์งํ๋ฉฐ ์ฑ๊ณต์ ์ผ๋ก ํ๋ฌ์ค(+) ํ์ต๋๋ค!" except Exception as e: return f"โ JSON ํ์ฑ ์๋ฌ: {e}"
custom_css = """#prompter_html_wrap { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important;}#prompter_html_wrap .prose { width: 100% !important; max-width: 100% !important; text-align: left !important; margin: 0 !important;}
#input_text_area textarea, #output_text_area textarea, #prompter_output_div { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important; letter-spacing: normal !important; word-spacing: normal !important;}
#input_text_area textarea { height: 500px !important; max-height: 500px !important; overflow-y: auto !important; padding: 16px !important; line-height: 1.8 !important; box-sizing: border-box !important; white-space: pre-wrap !important; word-break: break-word !important;}def get_file(): return dict_path if os.path.exists(dict_path) else None
#prompter_label_space { font-size: 13px !important; color: var(--body-text-color-subdued, #6b7280) !important; margin-bottom: 8px !important; display: block !important; text-align: left !important; font-weight: 400 !important;}def upload_file(file_path): if file_path is not None: shutil.copy(file_path, dict_path) return "โ
ํ์ผ ๋ณต๊ตฌ ์๋ฃ!" return "โ ๏ธ ํ์ผ์ด ์์ต๋๋ค."
#prompter_output_div { height: 500px !important; max-height: 500px !important; overflow-y: auto !important; padding: 16px !important; line-height: 1.8 !important; box-sizing: border-box !important; background-color: #333 !important; color: #fff !important; border: 1px solid #ddd !important; border-radius: 8px !important; white-space: pre-wrap !important; word-break: break-word !important; text-align: left !important; margin-top: 0 !important; width: 100% !important; max-width: 100% !important;}custom_css = """#prompter_html_wrap { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; }#prompter_html_wrap .prose { width: 100% !important; max-width: 100% !important; text-align: left !important; margin: 0 !important; }#input_text_area textarea, #output_text_area textarea, #prompter_output_div { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important; letter-spacing: normal !important; word-spacing: normal !important; }#input_text_area textarea { height: 500px !important; max-height: 500px !important; overflow-y: auto !important; padding: 16px !important; line-height: 1.8 !important; box-sizing: border-box !important; white-space: pre-wrap !important; word-break: break-word !important; }#prompter_label_space { font-size: 13px !important; color: var(--body-text-color-subdued, #6b7280) !important; margin-bottom: 8px !important; display: block !important; text-align: left !important; font-weight: 400 !important; }#prompter_output_div { height: 500px !important; max-height: 500px !important; overflow-y: auto !important; padding: 16px !important; line-height: 1.8 !important; box-sizing: border-box !important; background-color: #333 !important; color: #fff !important; border: 1px solid #ddd !important; border-radius: 8px !important; white-space: pre-wrap !important; word-break: break-word !important; text-align: left !important; margin-top: 0 !important; width: 100% !important; max-width: 100% !important; }"""
script_js = """4 unmodified lines let ta2 = document.querySelector('#output_text_area textarea'); if(ta2) { ta2.style.fontSize = size + 'px'; ta2.style.lineHeight = '1.8'; } }
setTimeout(function() { applyFontSize(22); }, 500);
let isSyncing1 = false; let isSyncing2 = false; let isSyncing3 = false; document.addEventListener('scroll', function(e) { let target = e.target; let ta1 = document.querySelector('#input_text_area textarea'); let ta2 = document.querySelector('#output_text_area textarea'); let div3 = document.getElementById('prompter_output_div');
if (!ta1 || !div3) return;
if (target === ta1) { if (isSyncing1) { isSyncing1 = false; return; } if (ta1.scrollHeight - ta1.clientHeight <= 0) return; isSyncing2 = true; isSyncing3 = true; let percentage = ta1.scrollTop / (ta1.scrollHeight - ta1.clientHeight); if (ta2 && ta2.scrollHeight - ta2.clientHeight > 0) { ta2.scrollTop = percentage * (ta2.scrollHeight - ta2.clientHeight); } if (div3.scrollHeight - div3.clientHeight > 0) { div3.scrollTop = percentage * (div3.scrollHeight - div3.clientHeight); } } else if (target === ta2) { if (isSyncing2) { isSyncing2 = false; return; } if (ta2 && ta2.scrollHeight - ta2.clientHeight <= 0) return; isSyncing1 = true; isSyncing3 = true; let percentage = ta2.scrollTop / (ta2.scrollHeight - ta2.clientHeight); if (ta1.scrollHeight - ta1.clientHeight > 0) { ta1.scrollTop = percentage * (ta1.scrollHeight - ta1.clientHeight); } if (div3.scrollHeight - div3.clientHeight > 0) { div3.scrollTop = percentage * (div3.scrollHeight - div3.clientHeight); } } else if (target === div3) { if (isSyncing3) { isSyncing3 = false; return; } if (div3.scrollHeight - div3.clientHeight <= 0) return; isSyncing1 = true; isSyncing2 = true; let percentage = div3.scrollTop / (div3.scrollHeight - div3.clientHeight); if (ta1.scrollHeight - ta1.clientHeight > 0) { ta1.scrollTop = percentage * (ta1.scrollHeight - ta1.clientHeight); } if (ta2 && ta2.scrollHeight - ta2.clientHeight > 0) { ta2.scrollTop = percentage * (ta2.scrollHeight - ta2.clientHeight); } } }, true);}"""
5 unmodified lines with gr.Row(): with gr.Column(): input_text = gr.Textbox(label="1๏ธโฃ ์๋ณธ ํ
์คํธ ์
๋ ฅ", elem_id="input_text_area") with gr.Group(): gr.Markdown("**โ๏ธ ๋ณํ ๋ฐ ํ๋ฉด ์ค์ **") # ์ฒดํฌ๋ฐ์ค ๋์ 3๋จ๊ณ ๋ผ๋์ค ๋ฒํผ์ผ๋ก ๊ต์ฒด ai_mode = gr.Radio( choices=["๋๊ธฐ (์๋ ์ฌ์ ๋ง ์ ์ฉ)", "์ํ ๋ง (๋จ์ด๋ณ ๋๊ธฐ - ๊ณผ๋ํ ์ฐ์ ๋ฐฉ์ง)", "๋งค์ด ๋ง (๋ฌธ์ฅ ํต์งธ๋ก - ์์ฐ์ค๋ฌ์ด ์ฐ์)"], value="๋๊ธฐ (์๋ ์ฌ์ ๋ง ์ ์ฉ)", label="๐ค AI ๋ฐ์ ๋ณํ ๊ฐ๋ ์ ํ" ) ai_mode = gr.Radio(choices=["๋๊ธฐ (์๋ ์ฌ์ ๋ง ์ ์ฉ)", "์ํ ๋ง (๋จ์ด๋ณ ๋๊ธฐ - ๊ณผ๋ํ ์ฐ์ ๋ฐฉ์ง)", "๋งค์ด ๋ง (๋ฌธ์ฅ ํต์งธ๋ก - ์์ฐ์ค๋ฌ์ด ์ฐ์)"], value="๋๊ธฐ (์๋ ์ฌ์ ๋ง ์ ์ฉ)", label="๐ค AI ๋ฐ์ ๋ณํ ๊ฐ๋ ์ ํ") auto_break = gr.Checkbox(label="๐ ๋ฌธ์ฅ ๋์์ ์๋์ผ๋ก ์ค๋ฐ๊ฟ ํ๊ธฐ", value=False) font_size = gr.Slider(minimum=16, maximum=40, value=22, step=2, label="๐ ๊ฒฐ๊ณผ์ฐฝ ๊ธ์ ํฌ๊ธฐ ์กฐ์ ") char_count = gr.Textbox(label="๊ธ์ ์ ํ์ธ", value="์
๋ ฅ ๊ธ์ ์: 0์", interactive=False) with gr.Row(): btn_conv = gr.Button("โจ ๋ณํํ๊ธฐ", variant="primary") btn_copy = gr.Button("๐ ๋ณํ๋ณต์ฌ", variant="secondary")2 unmodified lines with gr.Column(): initial_html = '<div id="prompter_label_space">๐บ ํ๋กฌํํฐ ๋ทฐ (๋ณ๊ฒฝ์ ํ์ธ)</div><div id="prompter_output_div" style="font-size:22px;"></div>' output_html = gr.HTML(value=initial_html, elem_id="prompter_html_wrap") with gr.Accordion("๐ ์์ ํ
์คํธ ๊ฒฐ๊ณผ (๋ณต์ฌ์ฉ) - ํด๋ฆญํด์ ํผ์น๊ธฐ", open=False): output_text = gr.Textbox(lines=8, show_label=False, show_copy_button=True, elem_id="output_text_area") gr.Markdown("---") gr.Markdown("**๐ก ๋๋ง์ ๋ฐ์ ์ฌ์ ์ถ๊ฐ** (โ
'๊ธฐ์กด ๋จ์ด'๋ ๋ฐ๋์ 1๋ฒ ์ฐฝ์์ ๋ณต์ฌํด์ค์ธ์ โ
)") gr.Markdown("**๐ก ๋๋ง์ ๋ฐ์ ์ฌ์ ์ถ๊ฐ** (โป 1๊ธ์ ๋จ์ด๋ ์๋ณธ ํผ์์ ๋ง๊ธฐ ์ํด ๋ฑ๋ก ๋ถ๊ฐํฉ๋๋ค!)") with gr.Row(): nw = gr.Textbox(label="๊ธฐ์กด ๋จ์ด ๋๋ ๋ฌธ์ฅ") nw = gr.Textbox(label="๊ธฐ์กด ๋จ์ด ๋๋ ๋ฌธ์ฅ (2๊ธ์ ์ด์)") np = gr.Textbox(label="์ํ๋ ๋ฐ์") with gr.Column(min_width=200): btn_add = gr.Button("๐พ ์ฌ์ ์ ์ถ๊ฐํ๊ณ ์ฆ์ ๋๋ณธ ๋ณํํ๊ธฐ", variant="primary") btn_clear_dict_inputs = gr.Button("๐งน ๋จ์ด ์
๋ ฅ์นธ ๋น์ฐ๊ธฐ", variant="secondary") status = gr.Textbox(label="์ ์ฅ ์ํ ๊ฒฐ๊ณผ์ฐฝ", interactive=False) # ์ด๋ฒคํธ ์ฐ๊ฒฐ (ai_mode ๋ณ์ ์ฌ์ฉ) btn_conv.click(fn=process_text, inputs=[input_text, ai_mode, auto_break, font_size], outputs=[output_text, output_html, char_count], api_name=False) btn_clr.click(fn=clear_all, outputs=[input_text, output_text, output_html, char_count], api_name=False) btn_copy.click( fn=None, inputs=[output_text], outputs=None, js="(text) => { if(text) { navigator.clipboard.writeText(text); alert('โ
๋ณต์ฌ ์๋ฃ!'); } }", api_name=False ) btn_conv.click(fn=process_text, inputs=[input_text, ai_mode, auto_break, font_size], outputs=[output_text, output_html, char_count]) btn_clr.click(fn=clear_all, outputs=[input_text, output_text, output_html, char_count]) btn_copy.click(fn=None, inputs=[output_text], outputs=None, js="(text) => { if(text) { navigator.clipboard.writeText(text); alert('โ
๋ณต์ฌ ์๋ฃ!'); } }") font_size.change(fn=process_text, inputs=[input_text, ai_mode, auto_break, font_size], outputs=[output_text, output_html, char_count]) ai_mode.change(fn=process_text, inputs=[input_text, ai_mode, auto_break, font_size], outputs=[output_text, output_html, char_count]) auto_break.change(fn=process_text, inputs=[input_text, ai_mode, auto_break, font_size], outputs=[output_text, output_html, char_count]) btn_add.click(fn=add_and_update, inputs=[nw, np, input_text, ai_mode, auto_break, font_size], outputs=[status, output_text, output_html, char_count]) btn_clear_dict_inputs.click(fn=lambda: ("", ""), outputs=[nw, np])
with gr.Tab("๐ฅ ์๋ ๋ฐฑ์
/์กฐํ/์์ (๋๋ ๋ฑ๋ก)"): dl_btn = gr.DownloadButton("๐ฅ 1. ํ์ฌ ์์ฑ๋ ์ฌ์ ๋ฐฑ์
ํ๊ธฐ (PC ๋ค์ด๋ก๋)") dl_btn.click(fn=get_file, outputs=[dl_btn]) font_size.change( fn=process_text, inputs=[input_text, ai_mode, auto_break, font_size], outputs=[output_text, output_html, char_count], api_name=False ).then( fn=None, inputs=[font_size], js="(size) => { " "let ta1 = document.querySelector('#input_text_area textarea'); " "if(ta1) { ta1.style.fontSize = size + 'px'; } " "let ta2 = document.querySelector('#output_text_area textarea'); " "if(ta2) { ta2.style.fontSize = size + 'px'; } " "}" ) gr.Markdown("---") gr.Markdown("### ๐ 2. ํ๋ฉด์์ ์ง์ ์ฌ์ ์กฐํ/์์ /์ญ์ ํ๊ธฐ (๋ค์ด๋ก๋ ๋ถ๊ฐ ํ๊ฒฝ์ฉ)") with gr.Row(): btn_load_json = gr.Button("๐ 1๋จ๊ณ: ํ์ฌ ๋ฑ๋ก๋ ๋ชจ๋ ๋จ์ด ๋ถ๋ฌ์ค๊ธฐ", variant="secondary") # ๋ฒํผ์ด๋ ์ต์
์ ํด๋ฆญํ์ ๋ ์ฆ์ ๋ณํ๋๋๋ก ์ด๋ฒคํธ ์ถ๊ฐ ai_mode.change(fn=process_text, inputs=[input_text, ai_mode, auto_break, font_size], outputs=[output_text, output_html, char_count], api_name=False) auto_break.change(fn=process_text, inputs=[input_text, ai_mode, auto_break, font_size], outputs=[output_text, output_html, char_count], api_name=False) json_input = gr.Textbox(lines=15, label="์ฌ๊ธฐ์ ๋จ์ด๋ค์ด ํ์๋ฉ๋๋ค. ์ด์ํ ๋จ์ด(์: '์ด': '์ข
')๋ฅผ ์ฐพ์ ๊ทธ ์ค์ ์ญ์ ํ์ธ์!") btn_add.click( fn=add_and_update, inputs=[nw, np, input_text, ai_mode, auto_break, font_size], outputs=[status, output_text, output_html, char_count], api_name=False ) with gr.Row(): btn_apply_json = gr.Button("๐ 2๋จ๊ณ: ๊ธฐ์กด ๋จ์ด์ฅ์ ํ๋ฌ์ค(+) ํ๊ธฐ", variant="primary") btn_overwrite_json = gr.Button("๐จ 2๋จ๊ณ: ์์ ํ ๋ด์ฉ์ผ๋ก ์์ ํ ๋ฎ์ด์ฐ๊ธฐ (๊ธฐ์กด ์ญ์ )", variant="stop") btn_clear_dict_inputs.click( fn=lambda: ("", ""), outputs=[nw, np], api_name=False )
with gr.Tab("๐ฅ ์๋ ๋ฐฑ์
/๋ณต๊ตฌ (๋๋ ๋ฑ๋ก)"): dl_btn = gr.DownloadButton("๐ฅ 1. ํ์ฌ ์์ฑ๋ ์ฌ์ ๋ฐฑ์
ํ๊ธฐ (PC ๋ค์ด๋ก๋)") dl_btn.click(fn=get_file, outputs=[dl_btn], api_name=False) json_stat = gr.Textbox(label="์ํ ๊ฒฐ๊ณผ์ฐฝ", interactive=False) gr.Markdown("---") gr.Markdown("### ๐ 2. ์ฝ๋๋ฅผ ๋ณต์ฌํด์ ์ง์ ๋ถ์ฌ๋ฃ๊ธฐ") json_input = gr.Textbox(lines=10, label="์ฌ๊ธฐ์ ์ถ์ถ๋ JSON ์ฝ๋๋ฅผ ๋ถ์ฌ๋ฃ์ผ์ธ์") btn_apply_json = gr.Button("๐ ๊ธฐ์กด ๋จ์ด์ฅ์ ํ๋ฌ์ค(+) ํ๊ธฐ", variant="primary") json_stat = gr.Textbox(label="๋ณต๊ตฌ ์ํ ๊ฒฐ๊ณผ์ฐฝ", interactive=False) btn_apply_json.click(fn=apply_json_text, inputs=[json_input], outputs=[json_stat], api_name=False) btn_load_json.click(fn=load_current_json_to_text, outputs=[json_input, json_stat]) btn_apply_json.click(fn=apply_json_text, inputs=[json_input], outputs=[json_stat]) btn_overwrite_json.click(fn=overwrite_json_text, inputs=[json_input], outputs=[json_stat])
gr.Markdown("---") gr.Markdown("### ๐ค 3. ๋ฐฑ์
ํ์ผ๋ก ๋ฎ์ด์ฐ๊ธฐ (โป ์ฃผ์: ๊ธฐ์กด ๋จ์ด ์ด๊ธฐํ๋จ)") up_file = gr.File(label="๋ฐฑ์
ํ์ผ ์
๋ก๋", type="filepath") up_stat = gr.Textbox(label="ํ์ผ ๋ณต๊ตฌ ์ํ ๊ฒฐ๊ณผ์ฐฝ", interactive=False) up_file.upload(fn=upload_file, inputs=[up_file], outputs=[up_stat], api_name=False) up_file.upload(fn=upload_file, inputs=[up_file], outputs=[up_stat])
iface.load(None, js=script_js)
app.py+108-227