openfree commited on
Commit
df34cc7
·
verified ·
1 Parent(s): e42012b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -360,11 +360,6 @@ def format_hn_time(timestamp):
360
  return "Unknown time"
361
 
362
 
363
-
364
-
365
-
366
-
367
-
368
  def clean_text(text):
369
  """HTML 태그 제거 및 텍스트 정리"""
370
  text = re.sub(r'\s+', ' ', text)
@@ -409,8 +404,8 @@ def generate_summary(text):
409
  try:
410
  response = hf_client.text_generation(
411
  prompt.format(text=text),
412
- max_new_tokens=150,
413
- temperature=0.7,
414
  repetition_penalty=1.2
415
  )
416
  return response
@@ -460,9 +455,9 @@ def refresh_hn_stories():
460
 
461
  # 병렬 처리로 요약 생성
462
  processed_stories = []
463
- with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
464
  future_to_story = {executor.submit(process_hn_story, story): story
465
- for story in stories[:20]} # 상위 20개만 처리
466
 
467
  for future in concurrent.futures.as_completed(future_to_story):
468
  story, summary = future.result()
 
360
  return "Unknown time"
361
 
362
 
 
 
 
 
 
363
  def clean_text(text):
364
  """HTML 태그 제거 및 텍스트 정리"""
365
  text = re.sub(r'\s+', ' ', text)
 
404
  try:
405
  response = hf_client.text_generation(
406
  prompt.format(text=text),
407
+ max_new_tokens=500,
408
+ temperature=0.5,
409
  repetition_penalty=1.2
410
  )
411
  return response
 
455
 
456
  # 병렬 처리로 요약 생성
457
  processed_stories = []
458
+ with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: # worker 수 증가
459
  future_to_story = {executor.submit(process_hn_story, story): story
460
+ for story in stories[:100]} # 100개로 수정
461
 
462
  for future in concurrent.futures.as_completed(future_to_story):
463
  story, summary = future.result()