fantos commited on
Commit
ae3bf31
ยท
verified ยท
1 Parent(s): 7573225

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -77
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'))