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