seawolf2357 commited on
Commit
1e20a8b
ยท
verified ยท
1 Parent(s): c80f381

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import gradio as gr
 
2
 
3
  # CSS ์Šคํƒ€์ผ ์ •์˜
4
  css_style = """
@@ -44,24 +45,19 @@ iframe {
44
  }
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:
58
- gr.Markdown("## AIQ์ฝ”๋“œํŒŒ์ผ๋Ÿฟ", elem_id="main-title")
59
  with gr.Row():
60
- gr.HTML(value='<iframe src="https://www.chatbase.co/chatbot-iframe/100-daum-net-eurma-q2o"></iframe>')
 
61
 
62
  # ์ž…๋ ฅ ํ•„๋“œ์™€ ๊ฒฐ๊ณผ ์ถœ๋ ฅ ์„ค์ •
63
  input_text = gr.Textbox(label="์—ฌ๊ธฐ์— ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”")
64
- result = gr.HTML()
65
  input_text.change(fn=process_result, inputs=input_text, outputs=result)
66
 
67
  return demo
 
1
  import gradio as gr
2
+ import os
3
 
4
  # CSS ์Šคํƒ€์ผ ์ •์˜
5
  css_style = """
 
45
  }
46
  """
47
 
48
+ # ํ™˜๊ฒฝ ๋ณ€์ˆ˜์—์„œ URL ๋ถˆ๋Ÿฌ์˜ค๊ธฐ
49
+ cburl = os.getenv("CBURL", "default_url_if_not_set")
 
 
 
 
 
 
50
 
51
  def app():
52
  with gr.Blocks(css=css_style) as demo:
53
+ gr.Markdown("# AIQ Codepilot", elem_id="main-title")
54
  with gr.Row():
55
+ # ๋น„๋ฐ€ URL ์‚ฌ์šฉ
56
+ gr.HTML(value=f'<iframe src="{cburl}"></iframe>')
57
 
58
  # ์ž…๋ ฅ ํ•„๋“œ์™€ ๊ฒฐ๊ณผ ์ถœ๋ ฅ ์„ค์ •
59
  input_text = gr.Textbox(label="์—ฌ๊ธฐ์— ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”")
60
+ result = gr.HTML()
61
  input_text.change(fn=process_result, inputs=input_text, outputs=result)
62
 
63
  return demo