Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -265,22 +265,22 @@ def morphological_analysis_and_enrich(text: str, remove_freq1: bool):
|
|
265 |
debug_log("morphological_analysis_and_enrich ν¨μ μλ£")
|
266 |
return merged_df, merged_excel_path
|
267 |
|
268 |
-
# μλ‘κ² μΆκ°λ κΈ°λ₯: μ
λ ₯ν λΈλ‘κ·Έ λ§ν¬λ‘λΆν°
|
269 |
-
def
|
270 |
-
debug_log("
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
# μ€ν¬λνλ λ΄μ©μ λ°λ‘ λΆμ ν
μ€νΈλ‘ νμ©
|
275 |
-
analysis_df, analysis_excel = morphological_analysis_and_enrich(blog_text, remove_freq1)
|
276 |
-
debug_log("analyze_blog_by_url ν¨μ μλ£")
|
277 |
-
return analysis_df, analysis_excel
|
278 |
|
279 |
-
# Gradio μΈν°νμ΄μ€ κ΅¬μ± (λ¨μΌ ν
|
280 |
with gr.Blocks(title="λ€μ΄λ² λΈλ‘κ·Έ ννμ λΆμ μ€νμ΄μ€", css=".gradio-container { max-width: 960px; margin: auto; }") as demo:
|
281 |
gr.Markdown("# λ€μ΄λ² λΈλ‘κ·Έ ννμ λΆμ μ€νμ΄μ€")
|
282 |
with gr.Row():
|
283 |
blog_url_input = gr.Textbox(label="λ€μ΄λ² λΈλ‘κ·Έ λ§ν¬", placeholder="μ: https://blog.naver.com/ssboost/222983068507", lines=1)
|
|
|
|
|
|
|
|
|
284 |
with gr.Row():
|
285 |
remove_freq_checkbox = gr.Checkbox(label="λΉλμ1 μ κ±°", value=False)
|
286 |
with gr.Row():
|
@@ -290,7 +290,10 @@ with gr.Blocks(title="λ€μ΄λ² λΈλ‘κ·Έ ννμ λΆμ μ€νμ΄μ€", css=".
|
|
290 |
with gr.Row():
|
291 |
analysis_excel = gr.File(label="Excel λ€μ΄λ‘λ")
|
292 |
|
293 |
-
|
|
|
|
|
|
|
294 |
|
295 |
if __name__ == "__main__":
|
296 |
debug_log("Gradio μ± μ€ν μμ")
|
|
|
265 |
debug_log("morphological_analysis_and_enrich ν¨μ μλ£")
|
266 |
return merged_df, merged_excel_path
|
267 |
|
268 |
+
# μλ‘κ² μΆκ°λ κΈ°λ₯: μ
λ ₯ν λΈλ‘κ·Έ λ§ν¬λ‘λΆν° μ€ν¬λννμ¬ μμ κ°λ₯ν ν
μ€νΈ λ°μ€μ μΆλ ₯
|
269 |
+
def fetch_blog_content(url: str):
|
270 |
+
debug_log("fetch_blog_content ν¨μ μμ")
|
271 |
+
content = scrape_naver_blog(url)
|
272 |
+
debug_log("fetch_blog_content ν¨μ μλ£")
|
273 |
+
return content
|
|
|
|
|
|
|
|
|
274 |
|
275 |
+
# Gradio μΈν°νμ΄μ€ κ΅¬μ± (λ¨μΌ ν)
|
276 |
with gr.Blocks(title="λ€μ΄λ² λΈλ‘κ·Έ ννμ λΆμ μ€νμ΄μ€", css=".gradio-container { max-width: 960px; margin: auto; }") as demo:
|
277 |
gr.Markdown("# λ€μ΄λ² λΈλ‘κ·Έ ννμ λΆμ μ€νμ΄μ€")
|
278 |
with gr.Row():
|
279 |
blog_url_input = gr.Textbox(label="λ€μ΄λ² λΈλ‘κ·Έ λ§ν¬", placeholder="μ: https://blog.naver.com/ssboost/222983068507", lines=1)
|
280 |
+
with gr.Row():
|
281 |
+
scrape_button = gr.Button("μ€ν¬λν μ€ν")
|
282 |
+
with gr.Row():
|
283 |
+
blog_content_box = gr.Textbox(label="λΈλ‘κ·Έ λ΄μ© (μμ κ°λ₯)", lines=10, placeholder="μ€ν¬λνλ λΈλ‘κ·Έ λ΄μ©μ΄ μ¬κΈ°μ νμλ©λλ€.")
|
284 |
with gr.Row():
|
285 |
remove_freq_checkbox = gr.Checkbox(label="λΉλμ1 μ κ±°", value=False)
|
286 |
with gr.Row():
|
|
|
290 |
with gr.Row():
|
291 |
analysis_excel = gr.File(label="Excel λ€μ΄λ‘λ")
|
292 |
|
293 |
+
# μ€ν¬λν μ€ν μ URLλ‘λΆν° λΈλ‘κ·Έ λ³Έλ¬Έ μ€ν¬λν ν μμ κ°λ₯ν ν
μ€νΈ λ°μ€μ μΆλ ₯
|
294 |
+
scrape_button.click(fn=fetch_blog_content, inputs=blog_url_input, outputs=blog_content_box)
|
295 |
+
# λΆμ μ€ν μ μμ λ λΈλ‘κ·Έ λ΄μ©μ λμμΌλ‘ ννμ λΆμ λ° κ²μλ/λΈλ‘κ·Έλ¬Έμμ μ‘°ν μ§ν
|
296 |
+
analyze_button.click(fn=morphological_analysis_and_enrich, inputs=[blog_content_box, remove_freq_checkbox], outputs=[analysis_result, analysis_excel])
|
297 |
|
298 |
if __name__ == "__main__":
|
299 |
debug_log("Gradio μ± μ€ν μμ")
|