Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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'>λ€μ΄λ² λΈλ‘κ·Έ ννμ λΆμ
|
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,
|