Update app.py
Browse files
app.py
CHANGED
@@ -602,27 +602,27 @@ def generate_report(title, info, progress=gr.Progress()):
|
|
602 |
progress(0.8, desc="๊ฒฐ๊ณผ ์ฒ๋ฆฌ ์ค...")
|
603 |
|
604 |
if response:
|
605 |
-
return
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
else:
|
610 |
-
return
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
|
615 |
except Exception as e:
|
616 |
print(f"Report generation error: {str(e)}")
|
617 |
-
return
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
|
622 |
def toggle_report(report_content):
|
623 |
"""๋ฆฌํฌํธ ํ์/์จ๊น ํ ๊ธ"""
|
624 |
-
|
625 |
-
|
626 |
|
627 |
css = """
|
628 |
footer {visibility: hidden;}
|
@@ -784,8 +784,8 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, title="NewsAI ์๋น์ค") as
|
|
784 |
info = gr.Markdown()
|
785 |
with gr.Row():
|
786 |
report_button = gr.Button("๋ฆฌํฌํ
์์ฑ", size="sm", variant="primary")
|
787 |
-
show_report = gr.Button("ํผ์ณ ๋ณด๊ธฐ", size="sm", visible=False)
|
788 |
with gr.Column(visible=False) as report_section:
|
|
|
789 |
report_content = gr.Markdown()
|
790 |
|
791 |
hn_article_components.append({
|
@@ -793,13 +793,14 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, title="NewsAI ์๋น์ค") as
|
|
793 |
'title': title,
|
794 |
'info': info,
|
795 |
'report_button': report_button,
|
796 |
-
'show_report': show_report,
|
797 |
'report_section': report_section,
|
|
|
798 |
'report_content': report_content,
|
799 |
'index': i,
|
800 |
})
|
801 |
|
802 |
|
|
|
803 |
|
804 |
|
805 |
# ๊ธฐ์กด ํจ์๋ค
|
|
|
602 |
progress(0.8, desc="๊ฒฐ๊ณผ ์ฒ๋ฆฌ ์ค...")
|
603 |
|
604 |
if response:
|
605 |
+
return [
|
606 |
+
gr.update(value=response, visible=True),
|
607 |
+
gr.update(value="์ ๊ธฐ", visible=True)
|
608 |
+
]
|
609 |
else:
|
610 |
+
return [
|
611 |
+
gr.update(value="๋ฆฌํฌํ
์์ฑ์ ์คํจํ์ต๋๋ค.", visible=True),
|
612 |
+
gr.update(value="์ ๊ธฐ", visible=True)
|
613 |
+
]
|
614 |
|
615 |
except Exception as e:
|
616 |
print(f"Report generation error: {str(e)}")
|
617 |
+
return [
|
618 |
+
gr.update(value="๋ฆฌํฌํ
์์ฑ ์ค ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.", visible=True),
|
619 |
+
gr.update(value="์ ๊ธฐ", visible=True)
|
620 |
+
]
|
621 |
|
622 |
def toggle_report(report_content):
|
623 |
"""๋ฆฌํฌํธ ํ์/์จ๊น ํ ๊ธ"""
|
624 |
+
is_visible = report_content.visible
|
625 |
+
return gr.update(visible=not is_visible)
|
626 |
|
627 |
css = """
|
628 |
footer {visibility: hidden;}
|
|
|
784 |
info = gr.Markdown()
|
785 |
with gr.Row():
|
786 |
report_button = gr.Button("๋ฆฌํฌํ
์์ฑ", size="sm", variant="primary")
|
|
|
787 |
with gr.Column(visible=False) as report_section:
|
788 |
+
show_report = gr.Button("ํผ์ณ ๋ณด๊ธฐ", size="sm")
|
789 |
report_content = gr.Markdown()
|
790 |
|
791 |
hn_article_components.append({
|
|
|
793 |
'title': title,
|
794 |
'info': info,
|
795 |
'report_button': report_button,
|
|
|
796 |
'report_section': report_section,
|
797 |
+
'show_report': show_report,
|
798 |
'report_content': report_content,
|
799 |
'index': i,
|
800 |
})
|
801 |
|
802 |
|
803 |
+
|
804 |
|
805 |
|
806 |
# ๊ธฐ์กด ํจ์๋ค
|