Kota Takahashi commited on
Commit
cb35de9
1 Parent(s): cc6c386

要約文章の長さを修正

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. summerizer.py +1 -1
app.py CHANGED
@@ -67,7 +67,7 @@ if st.session_state['news_fetched']:
67
 
68
  # テキストを要約
69
  summarizer = TextSummarizer()
70
- summary_text = summarizer.summarize(best_article_text, max_length=30, min_length=20)
71
  st.write(f'最も類似度が高いワードは「{best_max_word}」でした')
72
  st.write(f'url:{best_article_url}')
73
  st.text_area("要約:", summary_text, height=20)
 
67
 
68
  # テキストを要約
69
  summarizer = TextSummarizer()
70
+ summary_text = summarizer.summarize(best_article_text, max_length=40, min_length=20)
71
  st.write(f'最も類似度が高いワードは「{best_max_word}」でした')
72
  st.write(f'url:{best_article_url}')
73
  st.text_area("要約:", summary_text, height=20)
summerizer.py CHANGED
@@ -22,7 +22,7 @@ class TextSummarizer:
22
  # パイプラインを初期化
23
  self.summarizer = pipeline("summarization", model=self.model, tokenizer=self.tokenizer)
24
 
25
- def summarize(self, text, max_length=20, min_length=10):
26
  """
27
  テキストを要約
28
 
 
22
  # パイプラインを初期化
23
  self.summarizer = pipeline("summarization", model=self.model, tokenizer=self.tokenizer)
24
 
25
+ def summarize(self, text, max_length=30, min_length=10):
26
  """
27
  テキストを要約
28