unnastyle commited on
Commit
6e5bc1e
Β·
verified Β·
1 Parent(s): 3ac5a1d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -28
app.py CHANGED
@@ -7,6 +7,21 @@ import requests
7
  # 디버깅 λ‘œκΉ… μ„€μ • (전체 톡합을 μœ„ν•΄ 포맷 포함)
8
  logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  # ---------- [λͺ¨λ“ˆ1: κΈ°μ‘΄ κΈ°λ³Έμ½”λ“œ] μ‹œμž‘ ----------
11
  # μ˜μ–΄ 월을 ν•œκ΅­μ–΄ μ›”λ‘œ λ³€ν™˜ν•˜κΈ° μœ„ν•œ λ§€ν•‘
12
  month_mapping = {
@@ -206,7 +221,6 @@ def process_html_sections(html_text):
206
  logging.debug("HTML 처리 μ™„λ£Œ (μ„Ήμ…˜λ³„ 뢄리)")
207
  sections_list = list(sections_dict.keys())
208
  default_val = sections_list[0] if sections_list else None
209
- # gr.Dropdown.update() λŒ€μ‹  gr.update() μ‚¬μš©
210
  return subject_name, gr.update(choices=sections_list, value=default_val), sections_dict
211
 
212
  def update_lecture_and_urls(selected_section, sections_dict):
@@ -214,14 +228,13 @@ def update_lecture_and_urls(selected_section, sections_dict):
214
  μ„ νƒν•œ μ„Ήμ…˜μ„ λ°”νƒ•μœΌλ‘œ κ°•μ˜ λͺ©λ‘ ν…μŠ€νŠΈμ™€ URL듀을 μΆ”μΆœν•˜μ—¬
215
  - κ°•μ˜ λͺ©λ‘ ν…μŠ€νŠΈ(μ—†μœΌλ©΄ "κ°•μ˜κ°€ μ—†μŠ΅λ‹ˆλ‹€" λ°˜ν™˜)
216
  - μ΅œλŒ€ 3개의 κ°•μ˜ URL (κ°•μ˜ URL이 μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄)
217
- λ₯Ό λ°˜ν™˜.
218
  """
219
  if not selected_section or not sections_dict:
220
  return "", "", "", ""
221
  lectures_text, url_list = sections_dict.get(selected_section, ("", []))
222
  if not lectures_text:
223
  lectures_text = "κ°•μ˜κ°€ μ—†μŠ΅λ‹ˆλ‹€"
224
- # κ°•μ˜ URL 3개 μ±„μš°κΈ° (μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄)
225
  url1 = url_list[0] if len(url_list) >= 1 else ""
226
  url2 = url_list[1] if len(url_list) >= 2 else ""
227
  url3 = url_list[2] if len(url_list) >= 3 else ""
@@ -310,7 +323,6 @@ def process_full(lecture_url):
310
  """
311
  μž…λ ₯된 κ°•μ˜ URLλ‘œλΆ€ν„° 슀크립트 URL을 μƒμ„±ν•˜κ³ ,
312
  ν•΄λ‹Ή 슀크립트λ₯Ό κ°€μ Έμ˜¨ ν›„ νƒ€μž„λΌμΈμ„ μ œκ±°ν•œ μ΅œμ’… κ°•μ˜ λ‚΄μš©μ„ λ°˜ν™˜ν•˜λŠ” ν•¨μˆ˜.
313
- (쀑간 λ‹¨κ³„λŠ” 좜λ ₯ν•˜μ§€ μ•Šκ³  μ΅œμ’… 결과만 λ°˜ν™˜)
314
  """
315
  script_url = create_script_url(lecture_url)
316
  if not script_url:
@@ -324,10 +336,9 @@ def process_full(lecture_url):
324
  return cleaned
325
  # ---------- [λͺ¨λ“ˆ2: μΆ”κ°€μ½”λ“œ] 끝 ----------
326
 
327
- # ---------- [λͺ¨λ“ˆ3: κ°•μ˜λ‚΄μš© ν•©μΉ˜κΈ° μΆ”κ°€μ½”λ“œ] μ‹œμž‘ ----------
328
  with gr.Blocks() as merge_demo:
329
- gr.Markdown("## κ°•μ˜λ‚΄μš© ν•©μΉ˜κΈ°")
330
- # "κ°•μ˜λ‚΄μš© ν•©μΉ˜κΈ°" λ²„νŠΌ μ‚­μ œ (μš”μ²­μ‚¬ν•­μ— 따라 μ‚­μ œ)
331
  merged_content = gr.Textbox(label="전체 κ°•μ˜ λ‚΄μš©", lines=10, elem_id="merged_content")
332
  with gr.Row():
333
  merge_copy_btn = gr.Button("전체 κ°•μ˜ λ‚΄μš© λ³΅μ‚¬ν•˜κΈ°", elem_id="merge_copy_btn")
@@ -347,8 +358,6 @@ with gr.Blocks() as merge_demo:
347
  merged += "[κ°•μ˜3]\n" + l3.strip()
348
  return merged
349
 
350
- # "κ°•μ˜λ‚΄μš© ν•©μΉ˜κΈ°" λ²„νŠΌ μ‚­μ œμ— 따라 merge_btn κ΄€λ ¨ μ½”λ“œ 제거
351
-
352
  merge_copy_script = """
353
  <script>
354
  function setupMergeCopy(copyBtnId, textBoxId, resultBoxId) {
@@ -384,7 +393,7 @@ with gr.Blocks() as merge_demo:
384
  </script>
385
  """
386
  gr.HTML(merge_copy_script)
387
- # ---------- [λͺ¨λ“ˆ3: κ°•μ˜λ‚΄μš© ν•©μΉ˜κΈ° μΆ”κ°€μ½”λ“œ] 끝 ----------
388
 
389
  # ---------- μƒˆλ‘œμš΄ κΈ°λŠ₯: 'μ„ νƒν•œ μ„Ήμ…˜ κ°•μ˜ λͺ©λ‘'μ—μ„œ κ°•μ˜ URL μΆ”μΆœ 및 κ°•μ˜ λ‚΄μš© μžλ™ μ—…λ°μ΄νŠΈ κΈ°λŠ₯ μΆ”κ°€ ----------
390
  def merge_contents_global(l1, l2, l3):
@@ -430,13 +439,14 @@ def handle_fetch_all(lecture_list_text):
430
 
431
  # ---------- 톡합 Gradio μ•± ꡬ성 (ν•œ νŽ˜μ΄μ§€μ— λͺ¨λ‘ ν‘œμ‹œ) ----------
432
  with gr.Blocks() as additional_demo:
433
- gr.Markdown("β€» κ°•μ˜ URL 및 κ°•μ˜ λ‚΄μš©, 볡사 κΈ°λŠ₯은 μ•„λž˜μ— ν‘œμ‹œλ©λ‹ˆλ‹€.")
 
434
  with gr.Row():
435
  url1 = gr.Textbox(label="κ°•μ˜1 URL", elem_id="url1")
436
  url2 = gr.Textbox(label="κ°•μ˜2 URL", elem_id="url2")
437
  url3 = gr.Textbox(label="κ°•μ˜3 URL", elem_id="url3")
438
  with gr.Row():
439
- # κ°œλ³„ 'κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°' λ²„νŠΌ μ‚­μ œ (μš”μ²­μ‚¬ν•­μ— 따라 μ‚­μ œ)
440
  pass
441
  with gr.Row():
442
  lecture_content1 = gr.Textbox(label="κ°•μ˜ λ‚΄μš©", lines=10, elem_id="lecture_content1")
@@ -488,37 +498,37 @@ with gr.Blocks() as additional_demo:
488
  </script>
489
  """
490
  gr.HTML(custom_script)
491
- gr.Markdown("디버깅 λͺ¨λ“œ ν™œμ„±ν™”λ¨: λ‘œκ·Έκ°€ μ½˜μ†”μ— 좜λ ₯λ©λ‹ˆοΏ½οΏ½.")
492
 
493
  with gr.Blocks() as app:
 
494
  gr.Markdown("# μΊλ‘€λΌμΈλŒ€ν•™ κ°•μ˜ μΆ”μΆœκΈ°")
495
- gr.Markdown("전체 νŽ˜μ΄μ§€ HTML을 μž…λ ₯ν•˜λ©΄ κ³Όλͺ©λͺ…κ³Ό 각 μ„Ήμ…˜λ³„ λ™μ˜μƒ κ°•μ˜ λͺ©λ‘μ„ μΆ”μΆœν•©λ‹ˆλ‹€. (디버깅 μ •λ³΄λŠ” μ½˜μ†”μ— 좜λ ₯λ©λ‹ˆλ‹€.)")
496
  gr.HTML(
497
  """
498
  <div style="background-color: #f0f0f0; padding: 10px; margin-bottom: 20px;">
499
- <strong>μ‚¬μš©λ°©λ²•</strong>
500
  <ol>
501
  <li>μΆ”μΆœμ„ μ›ν•˜λŠ” κ°•μ˜ νŽ˜μ΄μ§€μ—μ„œ "Ctrl + U"λ₯Ό 눌러 νŽ˜μ΄μ§€ μ†ŒμŠ€λ₯Ό ν™•μΈν•˜κ±°λ‚˜, 마우슀 우클릭 ν›„ "νŽ˜μ΄μ§€ μ†ŒμŠ€ 보기"λ₯Ό μ„ νƒν•©λ‹ˆλ‹€.</li>
502
- <li>νŽ˜μ΄μ§€ μ†ŒμŠ€μ—μ„œ 전체 볡사 ν›„ ("Ctrl+A" β†’ "Ctrl+C"), μ™Όμͺ½μ˜ "전체 νŽ˜μ΄μ§€ HTML μž…λ ₯"에 λΆ™μ—¬λ„£μŠ΅λ‹ˆλ‹€.</li>
503
- <li>"Submit" λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ 였λ₯Έμͺ½μ— κ³Όλͺ©λͺ…, μ„Ήμ…˜ 선택, μ„ νƒν•œ μ„Ήμ…˜μ˜ κ°•μ˜ λͺ©λ‘μ΄ ν‘œμ‹œλ©λ‹ˆλ‹€.</li>
504
- <li>κ°•μ˜ λͺ©λ‘μ— 좜λ ₯된 κ°•μ˜ URL은 λ³„λ„λ‘œ μžλ™ μž…λ ₯λ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. ν•„μš”ν•œ 경우 μ•„λž˜μ˜ "κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°" λ²„νŠΌμ„ ν΄λ¦­ν•˜μ—¬ μ—…λ°μ΄νŠΈν•˜μ„Έμš”.</li>
505
- <li>μ—…λ°μ΄νŠΈ ν›„, 각 κ°•μ˜μ˜ λ‚΄μš©μ„ λ³΅μ‚¬ν•˜μ—¬ μ‚¬μš© κ°€λŠ₯ν•©λ‹ˆλ‹€.</li>
506
  </ol>
507
  </div>
508
  """
509
  )
510
- # λͺ¨λ“ˆ1: HTML μž…λ ₯ 및 였λ₯Έμͺ½μ— κ³Όλͺ©/μ„Ήμ…˜/κ°•μ˜ λͺ©λ‘ ν‘œμ‹œ
511
  with gr.Tab("HTML νŒŒμ‹± 및 μ„Ήμ…˜ 선택"):
512
  with gr.Row():
513
  with gr.Column():
514
- html_input = gr.Textbox(label="전체 νŽ˜μ΄μ§€ HTML μž…λ ₯", lines=20, placeholder="HTML μ½”λ“œλ₯Ό μž…λ ₯ν•˜μ„Έμš”...")
515
  parse_btn = gr.Button("Submit")
516
- with gr.Column():
517
- subject_out = gr.Textbox(label="κ³Όλͺ©λͺ…", interactive=False)
518
  section_dropdown = gr.Dropdown(label="μ„Ήμ…˜ 선택", choices=[], interactive=True)
519
- lecture_out = gr.Textbox(label="μ„ νƒν•œ μ„Ήμ…˜ κ°•μ˜ λͺ©λ‘", lines=10, interactive=False)
520
  with gr.Row():
521
- # [μš”μ²­μ‚¬ν•­]에 따라 "μ„ νƒν•œ μ„Ήμ…˜ κ°•μ˜ λͺ©λ‘" μ•„λž˜μ— 'κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°' λ²„νŠΌ μΆ”κ°€
522
  fetch_all_btn = gr.Button("κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°", elem_id="fetch_all_btn")
523
  sections_state = gr.State()
524
 
@@ -527,13 +537,13 @@ with gr.Blocks() as app:
527
  inputs=html_input,
528
  outputs=[subject_out, section_dropdown, sections_state]
529
  )
530
- # μ„Ήμ…˜ μ„ νƒμ‹œ κ°•μ˜λͺ©λ‘ ν…μŠ€νŠΈλ§Œ μ—…λ°μ΄νŠΈν•˜λŠ” 이벀트 등둝
531
  section_dropdown.change(
532
  fn=update_lecture_text_only,
533
  inputs=[section_dropdown, sections_state],
534
  outputs=lecture_out
535
  )
536
- # "κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°" λ²„νŠΌ ν΄λ¦­μ‹œ κ°•μ˜ URLκ³Ό λ‚΄μš© μ—…λ°μ΄νŠΈ (λ²„νŠΌ 클릭 μ‹œ [행동] μ‹€ν–‰)
537
  fetch_all_btn.click(
538
  fn=handle_fetch_all,
539
  inputs=lecture_out,
@@ -541,7 +551,7 @@ with gr.Blocks() as app:
541
  )
542
 
543
  gr.Markdown("---")
544
- gr.Markdown("λ™μ˜μƒ κ°•μ˜ λͺ©λ‘μ—μ„œ ν•„μš”ν•œ κ°•μ˜μ˜ URL을 λ³΅μ‚¬ν•˜μ—¬ μ‚¬μš©ν•˜μ„Έμš”.")
545
  additional_demo.render()
546
  merge_demo.render()
547
 
 
7
  # 디버깅 λ‘œκΉ… μ„€μ • (전체 톡합을 μœ„ν•΄ 포맷 포함)
8
  logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
9
 
10
+ # ---------- μ‚¬μš©μž μ •μ˜ CSS (μ™Όμͺ½κ³Ό 였λ₯Έμͺ½ μ˜μ—­μ˜ 높이λ₯Ό λ™μΌν•˜κ²Œ 맞좀) ----------
11
+ css = """
12
+ <style>
13
+ /* μ™Όμͺ½ '전체 νŽ˜μ΄μ§€ HTML μž…λ ₯' μ˜μ—­μ˜ textarea 높이 μ„€μ • */
14
+ #html_input textarea {
15
+ height: 400px !important;
16
+ }
17
+ /* 였λ₯Έμͺ½ μ˜μ—­μ„ κ°μ‹ΈλŠ” μ»¨ν…Œμ΄λ„ˆμ˜ 높이 μ„€μ • */
18
+ #right_panel {
19
+ height: 400px;
20
+ overflow-y: auto;
21
+ }
22
+ </style>
23
+ """
24
+
25
  # ---------- [λͺ¨λ“ˆ1: κΈ°μ‘΄ κΈ°λ³Έμ½”λ“œ] μ‹œμž‘ ----------
26
  # μ˜μ–΄ 월을 ν•œκ΅­μ–΄ μ›”λ‘œ λ³€ν™˜ν•˜κΈ° μœ„ν•œ λ§€ν•‘
27
  month_mapping = {
 
221
  logging.debug("HTML 처리 μ™„λ£Œ (μ„Ήμ…˜λ³„ 뢄리)")
222
  sections_list = list(sections_dict.keys())
223
  default_val = sections_list[0] if sections_list else None
 
224
  return subject_name, gr.update(choices=sections_list, value=default_val), sections_dict
225
 
226
  def update_lecture_and_urls(selected_section, sections_dict):
 
228
  μ„ νƒν•œ μ„Ήμ…˜μ„ λ°”νƒ•μœΌλ‘œ κ°•μ˜ λͺ©λ‘ ν…μŠ€νŠΈμ™€ URL듀을 μΆ”μΆœν•˜μ—¬
229
  - κ°•μ˜ λͺ©λ‘ ν…μŠ€νŠΈ(μ—†μœΌλ©΄ "κ°•μ˜κ°€ μ—†μŠ΅λ‹ˆλ‹€" λ°˜ν™˜)
230
  - μ΅œλŒ€ 3개의 κ°•μ˜ URL (κ°•μ˜ URL이 μ—†μœΌλ©΄ 빈 λ¬Έμžμ—΄)
231
+ 을 λ°˜ν™˜.
232
  """
233
  if not selected_section or not sections_dict:
234
  return "", "", "", ""
235
  lectures_text, url_list = sections_dict.get(selected_section, ("", []))
236
  if not lectures_text:
237
  lectures_text = "κ°•μ˜κ°€ μ—†μŠ΅λ‹ˆλ‹€"
 
238
  url1 = url_list[0] if len(url_list) >= 1 else ""
239
  url2 = url_list[1] if len(url_list) >= 2 else ""
240
  url3 = url_list[2] if len(url_list) >= 3 else ""
 
323
  """
324
  μž…λ ₯된 κ°•μ˜ URLλ‘œλΆ€ν„° 슀크립트 URL을 μƒμ„±ν•˜κ³ ,
325
  ν•΄λ‹Ή 슀크립트λ₯Ό κ°€μ Έμ˜¨ ν›„ νƒ€μž„λΌμΈμ„ μ œκ±°ν•œ μ΅œμ’… κ°•μ˜ λ‚΄μš©μ„ λ°˜ν™˜ν•˜λŠ” ν•¨μˆ˜.
 
326
  """
327
  script_url = create_script_url(lecture_url)
328
  if not script_url:
 
336
  return cleaned
337
  # ---------- [λͺ¨λ“ˆ2: μΆ”κ°€μ½”λ“œ] 끝 ----------
338
 
339
+ # ---------- [λͺ¨λ“ˆ3: κ°•μ˜ λ‚΄μš© ν•©μΉ˜κΈ° μΆ”κ°€μ½”λ“œ] μ‹œμž‘ ----------
340
  with gr.Blocks() as merge_demo:
341
+ gr.Markdown("## κ°•μ˜ λ‚΄μš© ν•©μΉ˜κΈ°")
 
342
  merged_content = gr.Textbox(label="전체 κ°•μ˜ λ‚΄μš©", lines=10, elem_id="merged_content")
343
  with gr.Row():
344
  merge_copy_btn = gr.Button("전체 κ°•μ˜ λ‚΄μš© λ³΅μ‚¬ν•˜κΈ°", elem_id="merge_copy_btn")
 
358
  merged += "[κ°•μ˜3]\n" + l3.strip()
359
  return merged
360
 
 
 
361
  merge_copy_script = """
362
  <script>
363
  function setupMergeCopy(copyBtnId, textBoxId, resultBoxId) {
 
393
  </script>
394
  """
395
  gr.HTML(merge_copy_script)
396
+ # ---------- [λͺ¨λ“ˆ3: κ°•μ˜ λ‚΄μš© ν•©μΉ˜κΈ° μΆ”κ°€μ½”λ“œ] 끝 ----------
397
 
398
  # ---------- μƒˆλ‘œμš΄ κΈ°λŠ₯: 'μ„ νƒν•œ μ„Ήμ…˜ κ°•μ˜ λͺ©λ‘'μ—μ„œ κ°•μ˜ URL μΆ”μΆœ 및 κ°•μ˜ λ‚΄μš© μžλ™ μ—…λ°μ΄νŠΈ κΈ°λŠ₯ μΆ”κ°€ ----------
399
  def merge_contents_global(l1, l2, l3):
 
439
 
440
  # ---------- 톡합 Gradio μ•± ꡬ성 (ν•œ νŽ˜μ΄μ§€μ— λͺ¨λ‘ ν‘œμ‹œ) ----------
441
  with gr.Blocks() as additional_demo:
442
+ # [λͺ¨λ“ˆ2] - κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ° μ˜μ—­ (μ‚­μ œλ‚΄μš© 제거 및 타이틀 μˆ˜μ •)
443
+ gr.Markdown("## κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°")
444
  with gr.Row():
445
  url1 = gr.Textbox(label="κ°•μ˜1 URL", elem_id="url1")
446
  url2 = gr.Textbox(label="κ°•μ˜2 URL", elem_id="url2")
447
  url3 = gr.Textbox(label="κ°•μ˜3 URL", elem_id="url3")
448
  with gr.Row():
449
+ # κ°œλ³„ 'κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°' λ²„νŠΌμ€ μ‚­μ œλ¨ (μš”μ²­μ‚¬ν•­μ— 따라 제거)
450
  pass
451
  with gr.Row():
452
  lecture_content1 = gr.Textbox(label="κ°•μ˜ λ‚΄μš©", lines=10, elem_id="lecture_content1")
 
498
  </script>
499
  """
500
  gr.HTML(custom_script)
501
+ # (μ‚­μ œλ‚΄μš© κ΄€λ ¨ gr.Markdown 제거)
502
 
503
  with gr.Blocks() as app:
504
+ gr.HTML(css) # μ‚¬μš©μž μ •μ˜ CSS μ‚½μž…
505
  gr.Markdown("# μΊλ‘€λΌμΈλŒ€ν•™ κ°•μ˜ μΆ”μΆœκΈ°")
506
+ gr.Markdown("[μ‚¬μš©λ°©λ²•] \n1. μΆ”μΆœμ„ μ›ν•˜λŠ” κ°•μ˜ νŽ˜μ΄μ§€μ—μ„œ \"Ctrl + U\"λ₯Ό 눌러 νŽ˜μ΄μ§€ μ†ŒμŠ€λ₯Ό ν™•μΈν•˜κ±°λ‚˜, 마우슀 우클릭 ν›„ \"νŽ˜μ΄μ§€ μ†ŒμŠ€ 보기\"λ₯Ό μ„ νƒν•©λ‹ˆλ‹€. \n2. νŽ˜μ΄μ§€ μ†ŒμŠ€μ—μ„œ 전체 볡사 ν•©λ‹ˆλ‹€. (\"Ctrl+A\" β†’ \"Ctrl+C\")\n3. λ³΅μ‚¬ν•œ λ‚΄μš©μ„ ν•΄λ‹Ή νŽ˜μ΄μ§€ \"전체 νŽ˜μ΄μ§€ HTML μž…λ ₯\"에 λΆ™μ—¬ 놓고(Ctrl+V) \"Submit\" λ²„νŠΌμ„ ν΄λ¦­ν•©λ‹ˆλ‹€.\n4. 였λ₯Έμͺ½ μ°½μ—μ„œ μ›ν•˜λŠ” μ„Ήμ…˜μ„ 선택 ν›„ \"κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°\" λ²„νŠΌμ„ ν΄λ¦­ν•©λ‹ˆλ‹€.\n5. κ°€μ Έμ˜¨ κ°•μ˜ λ‚΄μš© μ€‘μ—μ„œ ν•„μš”ν•œ λ‚΄μš©λ§Œ λ³΅μ‚¬ν•˜μ—¬ μ‚¬μš© κ°€λŠ₯ν•©λ‹ˆλ‹€.")
507
  gr.HTML(
508
  """
509
  <div style="background-color: #f0f0f0; padding: 10px; margin-bottom: 20px;">
510
+ <strong>[μ‚¬μš©λ°©λ²•]</strong>
511
  <ol>
512
  <li>μΆ”μΆœμ„ μ›ν•˜λŠ” κ°•μ˜ νŽ˜μ΄μ§€μ—μ„œ "Ctrl + U"λ₯Ό 눌러 νŽ˜μ΄μ§€ μ†ŒμŠ€λ₯Ό ν™•μΈν•˜κ±°λ‚˜, 마우슀 우클릭 ν›„ "νŽ˜μ΄μ§€ μ†ŒμŠ€ 보기"λ₯Ό μ„ νƒν•©λ‹ˆλ‹€.</li>
513
+ <li>νŽ˜μ΄μ§€ μ†ŒμŠ€μ—μ„œ 전체 볡사 ν•©λ‹ˆλ‹€. ("Ctrl+A" β†’ "Ctrl+C")</li>
514
+ <li>λ³΅μ‚¬ν•œ λ‚΄μš©μ„ ν•΄λ‹Ή νŽ˜μ΄μ§€ "전체 νŽ˜μ΄μ§€ HTML μž…λ ₯"에 λΆ™μ—¬ 놓고(Ctrl+V) "Submit" λ²„νŠΌμ„ ν΄λ¦­ν•©λ‹ˆλ‹€.</li>
515
+ <li>였λ₯Έμͺ½ μ°½μ—μ„œ μ›ν•˜λŠ” μ„Ήμ…˜μ„ 선택 ν›„ "κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°" λ²„νŠΌμ„ ν΄λ¦­ν•©λ‹ˆλ‹€.</li>
516
+ <li>κ°€μ Έμ˜¨ κ°•μ˜ λ‚΄μš© μ€‘μ—μ„œ ν•„μš”ν•œ λ‚΄μš©λ§Œ λ³΅μ‚¬ν•˜μ—¬ μ‚¬μš© κ°€λŠ₯ν•©λ‹ˆλ‹€.</li>
517
  </ol>
518
  </div>
519
  """
520
  )
521
+ # λͺ¨λ“ˆ1: HTML μž…λ ₯ 및 κ³Όλͺ©/μ„Ήμ…˜ ν‘œμ‹œ (μ™Όμͺ½κ³Ό 였λ₯Έμͺ½ μ˜μ—­μ˜ 높이λ₯Ό λ™μΌν•˜κ²Œ 맞좀)
522
  with gr.Tab("HTML νŒŒμ‹± 및 μ„Ήμ…˜ 선택"):
523
  with gr.Row():
524
  with gr.Column():
525
+ html_input = gr.Textbox(label="전체 νŽ˜μ΄μ§€ HTML μž…λ ₯", lines=20, placeholder="HTML μ½”λ“œλ₯Ό μž…λ ₯ν•˜μ„Έμš”...", elem_id="html_input")
526
  parse_btn = gr.Button("Submit")
527
+ with gr.Column(elem_id="right_panel"):
528
+ subject_out = gr.Textbox(label="κ³Όλͺ©λͺ…", interactive=False, lines=20)
529
  section_dropdown = gr.Dropdown(label="μ„Ήμ…˜ 선택", choices=[], interactive=True)
530
+ lecture_out = gr.Textbox(label="μ„ νƒν•œ μ„Ήμ…˜ κ°•μ˜ λͺ©λ‘", lines=20, interactive=False)
531
  with gr.Row():
 
532
  fetch_all_btn = gr.Button("κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°", elem_id="fetch_all_btn")
533
  sections_state = gr.State()
534
 
 
537
  inputs=html_input,
538
  outputs=[subject_out, section_dropdown, sections_state]
539
  )
540
+ # μ„Ήμ…˜ 선택 μ‹œ κ°•μ˜λͺ©λ‘ ν…μŠ€νŠΈλ§Œ μ—…λ°μ΄νŠΈ
541
  section_dropdown.change(
542
  fn=update_lecture_text_only,
543
  inputs=[section_dropdown, sections_state],
544
  outputs=lecture_out
545
  )
546
+ # "κ°•μ˜ λ‚΄μš© κ°€μ Έμ˜€κΈ°" λ²„νŠΌ 클릭 μ‹œ κ°•μ˜ URLκ³Ό λ‚΄μš© μ—…λ°μ΄νŠΈ ([행동] μ‹€ν–‰)
547
  fetch_all_btn.click(
548
  fn=handle_fetch_all,
549
  inputs=lecture_out,
 
551
  )
552
 
553
  gr.Markdown("---")
554
+ # (μ‚­μ œλ‚΄μš© κ΄€λ ¨ gr.Markdown 제거)
555
  additional_demo.render()
556
  merge_demo.render()
557