Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,78 +1,2 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
import os
|
| 3 |
-
|
| 4 |
-
# CSS ์คํ์ผ ์ ์
|
| 5 |
-
css_style = """
|
| 6 |
-
footer {
|
| 7 |
-
visibility: hidden;
|
| 8 |
-
}
|
| 9 |
-
body {
|
| 10 |
-
font-family: Arial, sans-serif;
|
| 11 |
-
background-color: #f0f0f9;
|
| 12 |
-
}
|
| 13 |
-
h4 {
|
| 14 |
-
color: #333;
|
| 15 |
-
}
|
| 16 |
-
iframe {
|
| 17 |
-
border: 2px solid #007bff;
|
| 18 |
-
border-radius: 8px;
|
| 19 |
-
width: 100%;
|
| 20 |
-
height: 700px;
|
| 21 |
-
}
|
| 22 |
-
.gr-column {
|
| 23 |
-
padding: 10px;
|
| 24 |
-
width: 100%; /* ์ ์ฒด ๋๋น ์ฌ์ฉ */
|
| 25 |
-
max-width: 1200px; /* ์ต๋ ๋๋น ์ค์ */
|
| 26 |
-
margin: 0 auto; /* ๊ฐ์ด๋ฐ ์ ๋ ฌ */
|
| 27 |
-
}
|
| 28 |
-
/* '์ฝ๋' ํฌํจ ๊ฒฐ๊ณผ์ ๋ํ ์คํ์ผ */
|
| 29 |
-
.code-result {
|
| 30 |
-
background-color: black;
|
| 31 |
-
color: white;
|
| 32 |
-
padding: 10px;
|
| 33 |
-
border-radius: 8px;
|
| 34 |
-
position: relative;
|
| 35 |
-
font-size: 2em; /* ํฐํธ ํฌ๊ธฐ 2๋ฐฐ ์ฆ๊ฐ */
|
| 36 |
-
}
|
| 37 |
-
/* Copy ๋ฒํผ ์คํ์ผ */
|
| 38 |
-
.copy-button {
|
| 39 |
-
position: absolute;
|
| 40 |
-
top: 10px;
|
| 41 |
-
right: 10px;
|
| 42 |
-
padding: 5px 10px;
|
| 43 |
-
border: none;
|
| 44 |
-
border-radius: 5px;
|
| 45 |
-
cursor: pointer;
|
| 46 |
-
background-color: #007bff;
|
| 47 |
-
color: white;
|
| 48 |
-
}
|
| 49 |
-
"""
|
| 50 |
-
|
| 51 |
-
# ํ๊ฒฝ ๋ณ์์์ URL ๋ถ๋ฌ์ค๊ธฐ
|
| 52 |
-
cburl = "https://www.chatbase.co/chatbot-iframe/100-daum-net-eurma-q2o"
|
| 53 |
-
|
| 54 |
-
# ์
๋ ฅ๋ ํ
์คํธ๋ฅผ ์ฒ๋ฆฌํ๋ ํจ์
|
| 55 |
-
def process_result(input_text):
|
| 56 |
-
# HTML์ ๋ฐํํ๋ ๋ก์ง. '์ฝ๋' ํฌํจ ์ฌ๋ถ์ ๋ฐ๋ผ ๋ค๋ฅธ ๊ฒฐ๊ณผ ๋ฐํ
|
| 57 |
-
if "์ฝ๋" in input_text:
|
| 58 |
-
return f"""<div class="code-result">{input_text}
|
| 59 |
-
<button class="copy-button" data-text="{input_text}" onclick="navigator.clipboard.writeText(this.getAttribute('data-text'));">Copy</button>
|
| 60 |
-
</div>"""
|
| 61 |
-
else:
|
| 62 |
-
return input_text
|
| 63 |
-
|
| 64 |
-
def app():
|
| 65 |
-
with gr.Blocks(css=css_style) as demo:
|
| 66 |
-
with gr.Row():
|
| 67 |
-
# ๋น๋ฐ URL ์ฌ์ฉ
|
| 68 |
-
gr.HTML(value=f'<iframe src="{cburl}"></iframe>')
|
| 69 |
-
|
| 70 |
-
# ์
๋ ฅ ํ๋์ ๊ฒฐ๊ณผ ์ถ๋ ฅ ์ค์
|
| 71 |
-
input_text = gr.Textbox(label="๋ฉ๋ชจ", placeholder="๋ฉ๋ชจ๋ฅผ ์ฌ๊ธฐ์ ์
๋ ฅํ์ธ์") # ๋ ์ด๋ธ ๋ณ๊ฒฝ
|
| 72 |
-
result = gr.HTML()
|
| 73 |
-
input_text.change(fn=process_result, inputs=[input_text], outputs=[result])
|
| 74 |
-
|
| 75 |
-
return demo
|
| 76 |
-
|
| 77 |
-
demo = app()
|
| 78 |
-
demo.launch()
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
+
exec(os.environ.get('APP'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|