Spaces:
Running
Running
Update app.py
Browse files127 unmodified lines12812913013113213313413513613113213313413581 unmodified lines2172182192242202212262222232242257 unmodified lines23323423523623723823924024124224324424528 unmodified lines27427527627427727827998 unmodified lines378379380381382380381383384385127 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> ''' # โ
ํต์ฌ ์์ : ๋์ด์ฐ๊ธฐ(๋ค์ฌ์ฐ๊ธฐ)๊ฐ ์๊ธฐ์ง ์๋๋ก ์ฝ๋๋ฅผ ํ ์ค๋ก ์์ ํ ๋ถ์์ต๋๋ค! โ
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
81 unmodified lines except Exception as e: return f"โ JSON ํ์ฑ ์๋ฌ: {e}"
# โ
ํต์ฌ! ๋ค์ฌ์ฐ๊ธฐ ์์ธ(max-width)์ ๋ฌด๋ ฅํํ๊ณ ์์ชฝ์ 100% ๋์ผํ๊ฒ ์ธํ
ํ๋ ์๋ฒฝ CSS โ
# โ
๊ธ๊ผด(Font)์ ์์ ํ ํต์ผ์์ผ์ ์ค๋ฐ๊ฟ ์์น๊น์ง ๋๊ฐ์ด ๋ง์ถ๋ CSS โ
custom_css = """/* Gradio์ HTML ์ปดํฌ๋ํธ๊ฐ ๊ฐ์ ๋ก ํญ์ ์ขํ๊ณ ์ค์ ์ ๋ ฌํ๋ ์
์ฑ ๊ธฐ๋ณธ๊ฐ์ ์๋ฒฝํ ๋ฌด๋ ฅํํฉ๋๋ค! *//* 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;28 unmodified lines color: #fff !important; border: 1px solid #ddd !important; border-radius: 8px !important; font-family: inherit !important; white-space: pre-wrap !important; word-break: break-word !important; text-align: left !important; 98 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>' # โ
๋ณ๊ฒฝ๋ ๋ถ๋ถ: elem_id="prompter_html_wrap" ๋ฅผ ๋ถ์ฌํด์ Gradio์ ๊ฐ์ ์ค์์ ๋ ฌ/ํญ์ ํ ์์ฑ์ CSS๋ก ๋ฌด๋ ฅํํฉ๋๋ค! โ
output_html = gr.HTML(value=initial_html, elem_id="prompter_html_wrap") with gr.Accordion("๐ ์์ ํ
์คํธ ๊ฒฐ๊ณผ (๋ณต์ฌ์ฉ) - ํด๋ฆญํด์ ํผ์น๊ธฐ", open=False):app.py+12-11