ginipick commited on
Commit
8ec0f44
ยท
verified ยท
1 Parent(s): 687e532

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -8
app.py CHANGED
@@ -141,8 +141,8 @@ def take_screenshot(url):
141
 
142
 
143
  def generate_usage_guide(app_content):
144
- system_message = "๋‹น์‹ ์€ Python ์ฝ”๋“œ๋ฅผ ๋ถ„์„ํ•˜์—ฌ, ํ™”๋ฉด ๋ณด๋“ฏ์ด ์ด์šฉ ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•˜๋Š” AI ์กฐ์ˆ˜์ž…๋‹ˆ๋‹ค. ์ฃผ์–ด์ง„ ์ฝ”๋“œ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ฝ”๋“œ์— ๋Œ€ํ•œ ์–ธ๊ธ‰์€ ์ œ์™ธํ•˜๊ณ , ์ด์šฉ์ž ๊ด€์ ์—์„œ ์นœ์ ˆํ•˜๊ณ  ์ž์„ธํ•˜๊ฒŒ ์ƒ์„ธํ•œ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ด์ฃผ์„ธ์š”."
145
- user_message = f"๋‹ค์Œ Python ์ฝ”๋“œ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ™”๋ฉด UI/UX์  ์ธก๋ฉด์œผ๋กœ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”:\n\n{app_content}"
146
 
147
  messages = [
148
  {"role": "system", "content": system_message},
@@ -170,8 +170,9 @@ def create_ui():
170
  margin-top: 5px !important;
171
  }
172
  #info-output, #usage-guide, #app-py-content {
173
- max-height: 300px;
174
  overflow-y: auto;
 
175
  }
176
  #app-py-content {
177
  height: auto;
@@ -183,6 +184,20 @@ def create_ui():
183
  padding: 10px;
184
  margin-bottom: 20px;
185
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  """
187
 
188
  with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
@@ -200,19 +215,19 @@ def create_ui():
200
 
201
  with gr.Column(scale=1):
202
  with gr.Group(elem_classes="output-group"):
203
- info_output = gr.Textbox(label="Space ์ •๋ณด ๋ฐ ์š”์•ฝ", elem_id="info-output", lines=10, max_lines=20)
204
  url_state = gr.State("")
205
  last_url_state = gr.State("")
206
 
207
  screenshot_output = gr.Image(type="pil", label="Live ํ™”๋ฉด", height=360, width=600)
208
- refresh_button = gr.Button("๐Ÿ”„ ์ƒˆ๋กœ๊ณ ์นจ", elem_id="refresh-button")
209
- manual_button = gr.Button("์„ ํƒ ์„œ๋น„์Šค ๋ฉ”๋‰ด์–ผ", elem_id="manual-button")
210
 
211
  with gr.Group(elem_classes="output-group"):
212
- usage_guide = gr.Textbox(label="์‚ฌ์šฉ ๋ฐฉ๋ฒ•", elem_id="usage-guide", visible=False, lines=10, max_lines=20)
213
 
214
  with gr.Group(elem_classes="output-group"):
215
- app_py_content = gr.Code(language="python", label="๋ฉ”์ธ ์†Œ์Šค์ฝ”๋“œ", elem_id="app-py-content", lines=20, max_lines=None)
216
 
217
  update_trigger = gr.Button("Update Screenshot", visible=False)
218
 
 
141
 
142
 
143
  def generate_usage_guide(app_content):
144
+ system_message = "๋‹น์‹ ์€ Python ์ฝ”๋“œ๋ฅผ ๋ถ„์„ํ•˜์—ฌ, ํ™”๋ฉด ๋ณด๋“ฏ์ด ์ด์šฉ ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•˜๋Š” AI ์กฐ์ˆ˜์ž…๋‹ˆ๋‹ค. app.py ์ฝ”๋“œ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ฝ”๋“œ์— ๋Œ€ํ•œ ์–ธ๊ธ‰์€ ์ œ์™ธํ•˜๊ณ , ์ด์šฉ์ž ๊ด€์ ์—์„œ 1) ๊ธฐ์กด ์œ ์‚ฌ ๊ธฐ์ˆ  ๋ฐฉ์‹๊ดด ๋น„๊ตํ•ด ํŠน์ง•, ์žฅ์ ์— ๋Œ€ํ•ด ์นœ์ ˆํ•˜๊ณ  ์ž์„ธํ•˜๊ฒŒ ์ƒ์„ธํ•œ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ด์ฃผ์„ธ์š”."
145
+ user_message = f"๋‹ค์Œ Python ์ฝ”๋“œ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ™”๋ฉด UI/UX์  ์ธก๋ฉด์œผ๋กœ ํŠน์ง•๊ณผ ์‚ฌ์šฉ ๋ฐฉ๋ฒ•์„ ์„ค๋ช…ํ•ด์ฃผ์„ธ์š”:\n\n{app_content}"
146
 
147
  messages = [
148
  {"role": "system", "content": system_message},
 
170
  margin-top: 5px !important;
171
  }
172
  #info-output, #usage-guide, #app-py-content {
173
+ max-height: 320px; /* ๋†’์ด๋ฅผ 320px๋กœ ์ฆ๊ฐ€ */
174
  overflow-y: auto;
175
+ padding-right: 10px; /* ์˜ค๋ฅธ์ชฝ ํŒจ๋”ฉ ์ถ”๊ฐ€ */
176
  }
177
  #app-py-content {
178
  height: auto;
 
184
  padding: 10px;
185
  margin-bottom: 20px;
186
  }
187
+ /* ์Šคํฌ๋กค๋ฐ” ์Šคํƒ€์ผ ์ˆ˜์ • */
188
+ ::-webkit-scrollbar {
189
+ width: 10px;
190
+ }
191
+ ::-webkit-scrollbar-track {
192
+ background: #f1f1f1;
193
+ }
194
+ ::-webkit-scrollbar-thumb {
195
+ background: #888;
196
+ border-radius: 5px;
197
+ }
198
+ ::-webkit-scrollbar-thumb:hover {
199
+ background: #555;
200
+ }
201
  """
202
 
203
  with gr.Blocks(css=css, theme="Nymbo/Nymbo_Theme") as demo:
 
215
 
216
  with gr.Column(scale=1):
217
  with gr.Group(elem_classes="output-group"):
218
+ info_output = gr.Textbox(label="Space ์ •๋ณด ๋ฐ ์š”์•ฝ", elem_id="info-output", lines=12, max_lines=22) # lines์™€ max_lines ์ฆ๊ฐ€
219
  url_state = gr.State("")
220
  last_url_state = gr.State("")
221
 
222
  screenshot_output = gr.Image(type="pil", label="Live ํ™”๋ฉด", height=360, width=600)
223
+ refresh_button = gr.Button("๐Ÿ”„ ํ™”๋ฉด ๊ฐฑ์‹ ", elem_id="refresh-button")
224
+ manual_button = gr.Button("์„ ํƒ ์„œ๋น„์Šค ํŠน์ง• ๋ฐ ์‚ฌ์šฉ๋ฒ•", elem_id="manual-button")
225
 
226
  with gr.Group(elem_classes="output-group"):
227
+ usage_guide = gr.Textbox(label="์‚ฌ์šฉ ๋ฐฉ๋ฒ•", elem_id="usage-guide", visible=False, lines=12, max_lines=22) # lines์™€ max_lines ์ฆ๊ฐ€
228
 
229
  with gr.Group(elem_classes="output-group"):
230
+ app_py_content = gr.Code(language="python", label="๋ฉ”์ธ ์†Œ์Šค์ฝ”๋“œ", elem_id="app-py-content", lines=22, max_lines=None) # lines ์ฆ๊ฐ€
231
 
232
  update_trigger = gr.Button("Update Screenshot", visible=False)
233