Spaces:
Running
Running
Update app.py
Browse files127 unmodified lines12812913013113113213382 unmodified lines2162172182202192222202212227 unmodified lines2302312322362332342352362372382432392402415 unmodified lines2472482492552502512523 unmodified lines25625725826525926026198 unmodified lines3603613623633703643653663674 unmodified lines372373374381375376377127 unmodified lines elif tag in['replace', 'insert']: 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_count82 unmodified lines except Exception as e: return f"โ JSON ํ์ฑ ์๋ฌ: {e}"
# โ
๊ธ๊ผด(Font)์ ์์ ํ ํต์ผ์์ผ์ ์ค๋ฐ๊ฟ ์์น๊น์ง ๋๊ฐ์ด ๋ง์ถ๋ CSS โ
custom_css = """/* Gradio์ HTML ์ปดํฌ๋ํธ ์ฌ๋ฐฑ ๊ฐ์ ์ด๊ธฐํ */#prompter_html_wrap { width: 100% !important; max-width: 100% !important;7 unmodified lines margin: 0 !important;}
/* ๋ชจ๋ ์
๋ ฅ์ฐฝ๊ณผ ์ถ๋ ฅ์ฐฝ์ ํฐํธ ์ข
๋ฅ, ํฌ๊ธฐ, ์๊ฐ์ 100% ๋์ผํ๊ฒ ๊ฐ์ ๊ณ ์ */#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;5 unmodified lines word-break: break-word !important;}
/* ์ค๋ฅธ์ชฝ ํ๋กฌํํฐ ๋ทฐ ๋ผ๋ฒจ */#prompter_label_space { font-size: 13px !important; color: var(--body-text-color-subdued, #6b7280) !important;3 unmodified lines font-weight: 400 !important;}
/* ์ค๋ฅธ์ชฝ ํ๋กฌํํฐ ๋ทฐ ๊น๋ง ์ฐฝ */#prompter_output_div { height: 500px !important; max-height: 500px !important;98 unmodified lines with gr.Group(): gr.Markdown("**โ๏ธ ๋ณํ ๋ฐ ํ๋ฉด ์ค์ **") use_g2p = gr.Checkbox(label="๐ค AI ๋ฐ์ ๋ณํ ์ผ๊ธฐ (์ฐ์ ์ฒ๋ฆฌ์ฉ)", value=False) # โ
์ด ๋ถ๋ถ์ value๋ฅผ True์์ False๋ก ๋ณ๊ฒฝํ์ต๋๋ค! โ
auto_break = gr.Checkbox(label="๐ ๋ฌธ์ฅ ๋์์ ์๋์ผ๋ก ์ค๋ฐ๊ฟ ํ๊ธฐ", value=True) 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)4 unmodified lines btn_clr = gr.Button("๐๏ธ ๋๋ณธ ์ด๊ธฐํ", variant="stop") with gr.Column(): # ๋ค์ฌ์ฐ๊ธฐ๋ฅผ ์์ฒ ์ฐจ๋จํ๊ธฐ ์ํด ๋์ด์ฐ๊ธฐ 1๋ ์์ด ๋ถ์ธ ํ ์ค ์ฝ๋์
๋๋ค! 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") app.py+2-9