Kims12 commited on
Commit
b06ebdb
Β·
verified Β·
1 Parent(s): b3072ce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -9
app.py CHANGED
@@ -302,7 +302,6 @@ custom_css = """
302
  background: #f5f7fa;
303
  padding: 2rem;
304
  }
305
-
306
  /* 헀더 μŠ€νƒ€μΌ */
307
  .custom-header {
308
  text-align: center;
@@ -311,7 +310,6 @@ custom_css = """
311
  margin-bottom: 1.5rem;
312
  color: #333;
313
  }
314
-
315
  /* κ·Έλ£Ή λ°•μŠ€ μŠ€νƒ€μΌ */
316
  .custom-group {
317
  background: #ffffff;
@@ -320,7 +318,6 @@ custom_css = """
320
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
321
  margin-bottom: 1.5rem;
322
  }
323
-
324
  /* λ²„νŠΌ μŠ€νƒ€μΌ */
325
  .custom-button {
326
  background-color: #007bff;
@@ -330,29 +327,53 @@ custom_css = """
330
  padding: 0.6rem 1.2rem;
331
  font-size: 1rem;
332
  cursor: pointer;
 
 
 
 
333
  }
334
-
335
  /* μ²΄ν¬λ°•μŠ€ μŠ€νƒ€μΌ */
336
  .custom-checkbox {
337
  margin-right: 1rem;
 
 
338
  }
339
-
340
  /* κ²°κ³Ό ν…Œμ΄λΈ” 및 λ‹€μš΄λ‘œλ“œ λ²„νŠΌ */
341
  .custom-result {
342
  margin-top: 1.5rem;
343
  }
344
-
345
  /* κ°€μš΄λ° μ •λ ¬ */
346
  .centered {
347
  display: flex;
348
  justify-content: center;
349
  align-items: center;
350
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
  """
352
 
353
  # --- Gradio μΈν„°νŽ˜μ΄μŠ€ ꡬ성 ---
354
  with gr.Blocks(title="넀이버 λΈ”λ‘œκ·Έ ν˜•νƒœμ†Œ 뢄석 μ„œλΉ„μŠ€", css=custom_css) as demo:
355
- gr.HTML("<div class='custom-header'>넀이버 λΈ”λ‘œκ·Έ ν˜•νƒœμ†Œ 뢄석 μ„œλΉ„μŠ€</div>")
356
  # λΈ”λ‘œκ·Έ 링크와 μŠ€ν¬λž˜ν•‘ μ‹€ν–‰ λ²„νŠΌμ„ ν•œ κ·Έλ£Ή 내에 배치 (λ²„νŠΌμ€ κ°€μš΄λ° μ •λ ¬)
357
  with gr.Group(elem_classes="custom-group"):
358
  with gr.Row():
@@ -365,7 +386,6 @@ with gr.Blocks(title="넀이버 λΈ”λ‘œκ·Έ ν˜•νƒœμ†Œ 뢄석 μ„œλΉ„μŠ€", css=custo
365
  with gr.Row():
366
  remove_freq_checkbox = gr.Checkbox(label="λΉˆλ„μˆ˜1 제거", value=True, elem_classes="custom-checkbox")
367
  with gr.Row():
368
- # "λΉˆλ„μˆ˜1 제거" μ•„λž˜μ— "직접 ν‚€μ›Œλ“œ μž…λ ₯만 뢄석" μ²΄ν¬λ°•μŠ€ 배치
369
  direct_keyword_only_checkbox = gr.Checkbox(label="직접 ν‚€μ›Œλ“œ μž…λ ₯만 뢄석", value=False, elem_classes="custom-checkbox")
370
  with gr.Row():
371
  direct_keyword_box = gr.Textbox(label="직접 ν‚€μ›Œλ“œ μž…λ ₯ (μ—”ν„° λ˜λŠ” ','둜 ꡬ뢄)", lines=2, placeholder="예: ν‚€μ›Œλ“œ1, ν‚€μ›Œλ“œ2\nν‚€μ›Œλ“œ3")
@@ -376,7 +396,28 @@ with gr.Blocks(title="넀이버 λΈ”λ‘œκ·Έ ν˜•νƒœμ†Œ 뢄석 μ„œλΉ„μŠ€", css=custo
376
  result_df = gr.Dataframe(label="톡합 뢄석 κ²°κ³Ό (단어, λΉˆλ„μˆ˜, κ²€μƒ‰λŸ‰, λΈ”λ‘œκ·Έλ¬Έμ„œμˆ˜, μ§μ ‘μž…λ ₯)", interactive=True)
377
  with gr.Group(elem_classes="custom-group"):
378
  excel_file = gr.File(label="Excel λ‹€μš΄λ‘œλ“œ")
379
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  # 이벀트 μ—°κ²°
381
  scrape_button.click(fn=fetch_blog_content, inputs=blog_url_input, outputs=blog_content_box)
382
  analyze_button.click(fn=analysis_handler,
 
302
  background: #f5f7fa;
303
  padding: 2rem;
304
  }
 
305
  /* 헀더 μŠ€νƒ€μΌ */
306
  .custom-header {
307
  text-align: center;
 
310
  margin-bottom: 1.5rem;
311
  color: #333;
312
  }
 
313
  /* κ·Έλ£Ή λ°•μŠ€ μŠ€νƒ€μΌ */
314
  .custom-group {
315
  background: #ffffff;
 
318
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
319
  margin-bottom: 1.5rem;
320
  }
 
321
  /* λ²„νŠΌ μŠ€νƒ€μΌ */
322
  .custom-button {
323
  background-color: #007bff;
 
327
  padding: 0.6rem 1.2rem;
328
  font-size: 1rem;
329
  cursor: pointer;
330
+ transition: background-color 0.3s;
331
+ }
332
+ .custom-button:hover {
333
+ background-color: #0056b3;
334
  }
 
335
  /* μ²΄ν¬λ°•μŠ€ μŠ€νƒ€μΌ */
336
  .custom-checkbox {
337
  margin-right: 1rem;
338
+ font-size: 1rem;
339
+ font-weight: bold;
340
  }
 
341
  /* κ²°κ³Ό ν…Œμ΄λΈ” 및 λ‹€μš΄λ‘œλ“œ λ²„νŠΌ */
342
  .custom-result {
343
  margin-top: 1.5rem;
344
  }
 
345
  /* κ°€μš΄λ° μ •λ ¬ */
346
  .centered {
347
  display: flex;
348
  justify-content: center;
349
  align-items: center;
350
  }
351
+ /* μ‚¬μš©μ„€λͺ… μŠ€νƒ€μΌ */
352
+ .usage-instructions {
353
+ font-size: 1.1rem;
354
+ line-height: 1.6;
355
+ color: #555;
356
+ background: #fff;
357
+ padding: 1.5rem;
358
+ border-radius: 8px;
359
+ box-shadow: 0 2px 8px rgba(0,0,0,0.1);
360
+ margin-top: 2rem;
361
+ }
362
+ .usage-instructions h2 {
363
+ font-size: 1.8rem;
364
+ font-weight: bold;
365
+ margin-bottom: 1rem;
366
+ color: #333;
367
+ }
368
+ .usage-instructions ul {
369
+ list-style: disc;
370
+ margin-left: 2rem;
371
+ }
372
  """
373
 
374
  # --- Gradio μΈν„°νŽ˜μ΄μŠ€ ꡬ성 ---
375
  with gr.Blocks(title="넀이버 λΈ”λ‘œκ·Έ ν˜•νƒœμ†Œ 뢄석 μ„œλΉ„μŠ€", css=custom_css) as demo:
376
+ gr.HTML("<div class='custom-header'>넀이버 λΈ”λ‘œκ·Έ ν˜•νƒœμ†Œ 뢄석 μ„œλΉ„μŠ€ πŸš€</div>")
377
  # λΈ”λ‘œκ·Έ 링크와 μŠ€ν¬λž˜ν•‘ μ‹€ν–‰ λ²„νŠΌμ„ ν•œ κ·Έλ£Ή 내에 배치 (λ²„νŠΌμ€ κ°€μš΄λ° μ •λ ¬)
378
  with gr.Group(elem_classes="custom-group"):
379
  with gr.Row():
 
386
  with gr.Row():
387
  remove_freq_checkbox = gr.Checkbox(label="λΉˆλ„μˆ˜1 제거", value=True, elem_classes="custom-checkbox")
388
  with gr.Row():
 
389
  direct_keyword_only_checkbox = gr.Checkbox(label="직접 ν‚€μ›Œλ“œ μž…λ ₯만 뢄석", value=False, elem_classes="custom-checkbox")
390
  with gr.Row():
391
  direct_keyword_box = gr.Textbox(label="직접 ν‚€μ›Œλ“œ μž…λ ₯ (μ—”ν„° λ˜λŠ” ','둜 ꡬ뢄)", lines=2, placeholder="예: ν‚€μ›Œλ“œ1, ν‚€μ›Œλ“œ2\nν‚€μ›Œλ“œ3")
 
396
  result_df = gr.Dataframe(label="톡합 뢄석 κ²°κ³Ό (단어, λΉˆλ„μˆ˜, κ²€μƒ‰λŸ‰, λΈ”λ‘œκ·Έλ¬Έμ„œμˆ˜, μ§μ ‘μž…λ ₯)", interactive=True)
397
  with gr.Group(elem_classes="custom-group"):
398
  excel_file = gr.File(label="Excel λ‹€μš΄λ‘œλ“œ")
399
+ # μ‚¬μš©μ„€λͺ… HTML 블둝 (μ•„λž˜μ— 배치)
400
+ with gr.Group(elem_classes="custom-group"):
401
+ usage_html = gr.HTML("""
402
+ <div class="usage-instructions">
403
+ <h2>μ‚¬μš© μ„€λͺ… πŸ“–</h2>
404
+ <ul>
405
+ <li>πŸ”— <strong>넀이버 λΈ”λ‘œκ·Έ 링크</strong>: 뢄석할 넀이버 λΈ”λ‘œκ·Έμ˜ URL을 μž…λ ₯ν•˜μ„Έμš”.</li>
406
+ <li>βœ‚οΈ <strong>μŠ€ν¬λž˜ν•‘ μ‹€ν–‰</strong>: 링크 μž…λ ₯ ν›„ λ²„νŠΌμ„ ν΄λ¦­ν•˜λ©΄ λΈ”λ‘œκ·Έμ˜ 제λͺ©κ³Ό 본문이 μžλ™μœΌλ‘œ λΆˆλŸ¬μ™€μ§‘λ‹ˆλ‹€.</li>
407
+ <li>πŸ“ <strong>λΈ”λ‘œκ·Έ λ‚΄μš© (μˆ˜μ • κ°€λŠ₯)</strong>: 뢈러온 λΈ”λ‘œκ·Έ λ‚΄μš©μ΄ ν‘œμ‹œλ˜λ©°, ν•„μš”μ— 따라 직접 μˆ˜μ •ν•  수 μžˆμŠ΅λ‹ˆλ‹€.</li>
408
+ <li>βš™οΈ <strong>μ˜΅μ…˜ μ„€μ •</strong>:
409
+ <ul>
410
+ <li><em>λΉˆλ„μˆ˜1 제거</em>: κΈ°λ³Έ μ„ νƒλ˜μ–΄ 있으며, λΉˆλ„μˆ˜κ°€ 1인 λ‹¨μ–΄λŠ” κ²°κ³Όμ—μ„œ μ œμ™Έν•©λ‹ˆλ‹€.</li>
411
+ <li><em>직접 ν‚€μ›Œλ“œ μž…λ ₯만 뢄석</em>: 이 μ˜΅μ…˜μ„ μ„ νƒν•˜λ©΄, λΈ”λ‘œκ·Έ λ³Έλ¬Έμ—μ„œ 직접 μž…λ ₯ν•œ ν‚€μ›Œλ“œλ§Œ λΆ„μ„ν•©λ‹ˆλ‹€.</li>
412
+ </ul>
413
+ </li>
414
+ <li>πŸ”€ <strong>직접 ν‚€μ›Œλ“œ μž…λ ₯</strong>: μ—”ν„° λ˜λŠ” μ‰Όν‘œ(,)둜 κ΅¬λΆ„ν•˜μ—¬ 뢄석할 ν‚€μ›Œλ“œλ₯Ό μž…λ ₯ν•˜μ„Έμš”.</li>
415
+ <li>πŸš€ <strong>뢄석 μ‹€ν–‰</strong>: μ„€μ •ν•œ μ˜΅μ…˜μ— 따라 ν˜•νƒœμ†Œ 뢄석 및 ν‚€μ›Œλ“œ 뢄석이 μˆ˜ν–‰λ˜μ–΄ κ²°κ³Όκ°€ ν‘œμ™€ Excel 파일둜 좜λ ₯λ©λ‹ˆλ‹€.</li>
416
+ <li>πŸ“₯ <strong>Excel λ‹€μš΄λ‘œλ“œ</strong>: 뢄석 κ²°κ³Όλ₯Ό Excel 파일둜 λ‹€μš΄λ‘œλ“œν•  수 μžˆμŠ΅λ‹ˆλ‹€.</li>
417
+ </ul>
418
+ <p><strong>Tip:</strong> 뢄석 κ²°κ³ΌλŠ” μ‹€μ‹œκ°„μœΌλ‘œ μ—…λ°μ΄νŠΈλ˜λ©°, ν•„μš”μ‹œ μˆ˜μ • ν›„ λ‹€μ‹œ 뢄석할 수 μžˆμŠ΅λ‹ˆλ‹€. 즐거운 뢄석 λ˜μ„Έμš”! 😊</p>
419
+ </div>
420
+ """)
421
  # 이벀트 μ—°κ²°
422
  scrape_button.click(fn=fetch_blog_content, inputs=blog_url_input, outputs=blog_content_box)
423
  analyze_button.click(fn=analysis_handler,