openfree commited on
Commit
f1d5105
ยท
verified ยท
1 Parent(s): 04130d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -16
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
- report_content: gr.update(value=response, visible=True),
607
- show_report: gr.update(value="์ ‘๊ธฐ", visible=True)
608
- }
609
  else:
610
- return {
611
- report_content: gr.update(value="๋ฆฌํฌํŒ… ์ƒ์„ฑ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค.", visible=True),
612
- show_report: gr.update(value="์ ‘๊ธฐ", visible=True)
613
- }
614
 
615
  except Exception as e:
616
  print(f"Report generation error: {str(e)}")
617
- return {
618
- report_content: gr.update(value="๋ฆฌํฌํŒ… ์ƒ์„ฑ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.", visible=True),
619
- show_report: gr.update(value="์ ‘๊ธฐ", visible=True)
620
- }
621
 
622
  def toggle_report(report_content):
623
  """๋ฆฌํฌํŠธ ํ‘œ์‹œ/์ˆจ๊น€ ํ† ๊ธ€"""
624
- return gr.update(visible=not report_content.visible)
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
  # ๊ธฐ์กด ํ•จ์ˆ˜๋“ค