seawolf2357 commited on
Commit
9293d24
ยท
verified ยท
1 Parent(s): 65c33ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -12
app.py CHANGED
@@ -9,37 +9,54 @@ body {
9
  font-family: Arial, sans-serif;
10
  background-color: #f0f0f9;
11
  }
12
-
13
  h4 {
14
  color: #333;
15
  }
16
-
17
  iframe {
18
  border: 2px solid #007bff;
19
  border-radius: 8px;
20
- width: 100%; /* IFrame์˜ ๋„ˆ๋น„๋ฅผ ์ปฌ๋Ÿผ์˜ ๋„ˆ๋น„์— ๋งž์ถ”๋„๋ก ์„ค์ • */
21
- height: 700px; /* ๋†’์ด ์„ค์ •์€ ๊ทธ๋Œ€๋กœ ์œ ์ง€ */
22
  }
23
-
24
  .gr-column {
25
  padding: 10px;
26
- width: 50%; /* ๊ฐ ์ปฌ๋Ÿผ์ด ์ „์ฒด ๋„ˆ๋น„์˜ 50%๋ฅผ ์ฐจ์ง€ํ•˜๋„๋ก ์„ค์ • */
 
 
 
 
 
 
 
27
  }
 
28
 
29
- /* ๋งˆํฌ๋‹ค์šด ๋ฐ HTML ์ปดํฌ๋„ŒํŠธ์˜ ์Šคํƒ€์ผ์„ ์ถ”๊ฐ€ ์ •์˜ํ•  ์ˆ˜ ์žˆ์Œ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  """
31
 
32
  def app():
33
- # Gradio ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์„ฑ
34
- with gr.Blocks(css=css_style) as demo:
35
  gr.Markdown("# AIQ Codepilot TEST", elem_id="main-title")
36
  with gr.Row():
37
- # ์ฒซ ๋ฒˆ์งธ HTML ์ปดํฌ๋„ŒํŠธ๋กœ IFrame ๊ตฌํ˜„
38
  with gr.Column():
39
  gr.Markdown("### AIQ Codepilot", elem_id="title-1")
40
  gr.HTML(value='<iframe src="https://www.chatbase.co/chatbot-iframe/100-daum-net-eurma-q2o"></iframe>')
41
 
42
- # ๋‘ ๋ฒˆ์งธ HTML ์ปดํฌ๋„ŒํŠธ๋กœ IFrame ๊ตฌํ˜„
43
  with gr.Column():
44
  gr.Markdown("### ์›น์„œ๋น„์Šค ๋™์ž‘ ํ™”๋ฉด", elem_id="title-2")
45
  gr.HTML(value='<iframe src="https://seawolf2357-frametest1.hf.space"></iframe>')
@@ -48,4 +65,3 @@ def app():
48
 
49
  demo = app()
50
  demo.launch(auth=("arxiv", "gpt"))
51
-
 
9
  font-family: Arial, sans-serif;
10
  background-color: #f0f0f9;
11
  }
 
12
  h4 {
13
  color: #333;
14
  }
 
15
  iframe {
16
  border: 2px solid #007bff;
17
  border-radius: 8px;
18
+ width: 100%;
19
+ height: 700px;
20
  }
 
21
  .gr-column {
22
  padding: 10px;
23
+ width: 50%;
24
+ }
25
+ /* '์ฝ”๋“œ' ํฌํ•จ ๊ฒฐ๊ณผ์— ๋Œ€ํ•œ ์Šคํƒ€์ผ */
26
+ .code-result {
27
+ background-color: black;
28
+ color: white;
29
+ padding: 10px;
30
+ border-radius: 8px;
31
  }
32
+ """
33
 
34
+ # JavaScript๋กœ '์ฝ”๋“œ' ํฌํ•จ ๊ฒฐ๊ณผ ๊ฐ์ง€ ๋ฐ ์ฒ˜๋ฆฌ ๋กœ์ง
35
+ javascript = """
36
+ document.addEventListener('DOMContentLoaded', (event) => {
37
+ const results = document.querySelectorAll('.gr-output');
38
+ results.forEach((result) => {
39
+ if (result.innerText.includes('์ฝ”๋“œ')) {
40
+ result.classList.add('code-result');
41
+ const copyButton = document.createElement('button');
42
+ copyButton.innerText = 'Copy';
43
+ copyButton.onclick = function() {
44
+ navigator.clipboard.writeText(result.innerText);
45
+ };
46
+ result.appendChild(copyButton);
47
+ }
48
+ });
49
+ });
50
  """
51
 
52
  def app():
53
+ with gr.Blocks(css=css_style, js=javascript) as demo:
 
54
  gr.Markdown("# AIQ Codepilot TEST", elem_id="main-title")
55
  with gr.Row():
 
56
  with gr.Column():
57
  gr.Markdown("### AIQ Codepilot", elem_id="title-1")
58
  gr.HTML(value='<iframe src="https://www.chatbase.co/chatbot-iframe/100-daum-net-eurma-q2o"></iframe>')
59
 
 
60
  with gr.Column():
61
  gr.Markdown("### ์›น์„œ๋น„์Šค ๋™์ž‘ ํ™”๋ฉด", elem_id="title-2")
62
  gr.HTML(value='<iframe src="https://seawolf2357-frametest1.hf.space"></iframe>')
 
65
 
66
  demo = app()
67
  demo.launch(auth=("arxiv", "gpt"))