Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -45,10 +45,13 @@ iframe {
|
|
| 45 |
"""
|
| 46 |
|
| 47 |
def process_result(input_text):
|
| 48 |
-
# HTML
|
| 49 |
-
|
|
|
|
| 50 |
<button class="copy-button" data-text="{input_text}" onclick="navigator.clipboard.writeText(this.getAttribute('data-text'));">Copy</button>
|
| 51 |
</div>"""
|
|
|
|
|
|
|
| 52 |
|
| 53 |
def app():
|
| 54 |
with gr.Blocks(css=css_style) as demo:
|
|
@@ -62,8 +65,9 @@ def app():
|
|
| 62 |
gr.Markdown("### ์น์๋น์ค ๋์ ํ๋ฉด", elem_id="title-2")
|
| 63 |
gr.HTML(value='<iframe src="https://seawolf2357-frametest1.hf.space"></iframe>')
|
| 64 |
|
|
|
|
| 65 |
input_text = gr.Textbox(label="์ฌ๊ธฐ์ ์ฝ๋๋ฅผ ์
๋ ฅํ์ธ์")
|
| 66 |
-
result = gr.HTML(
|
| 67 |
input_text.change(fn=process_result, inputs=input_text, outputs=result)
|
| 68 |
|
| 69 |
return demo
|
|
|
|
| 45 |
"""
|
| 46 |
|
| 47 |
def process_result(input_text):
|
| 48 |
+
# HTML์ ๋ฐํํ๋ ๋ก์ง. '์ฝ๋' ํฌํจ ์ฌ๋ถ์ ๋ฐ๋ผ ๋ค๋ฅธ ๊ฒฐ๊ณผ ๋ฐํ
|
| 49 |
+
if "์ฝ๋" in input_text:
|
| 50 |
+
return f"""<div class="code-result">{input_text}
|
| 51 |
<button class="copy-button" data-text="{input_text}" onclick="navigator.clipboard.writeText(this.getAttribute('data-text'));">Copy</button>
|
| 52 |
</div>"""
|
| 53 |
+
else:
|
| 54 |
+
return input_text
|
| 55 |
|
| 56 |
def app():
|
| 57 |
with gr.Blocks(css=css_style) as demo:
|
|
|
|
| 65 |
gr.Markdown("### ์น์๋น์ค ๋์ ํ๋ฉด", elem_id="title-2")
|
| 66 |
gr.HTML(value='<iframe src="https://seawolf2357-frametest1.hf.space"></iframe>')
|
| 67 |
|
| 68 |
+
# ์
๋ ฅ ํ๋์ ๊ฒฐ๊ณผ ์ถ๋ ฅ ์ค์
|
| 69 |
input_text = gr.Textbox(label="์ฌ๊ธฐ์ ์ฝ๋๋ฅผ ์
๋ ฅํ์ธ์")
|
| 70 |
+
result = gr.HTML() # `live=True` ๋งค๊ฐ๋ณ์ ์ ๊ฑฐ
|
| 71 |
input_text.change(fn=process_result, inputs=input_text, outputs=result)
|
| 72 |
|
| 73 |
return demo
|