jinv2 commited on
Commit
9b18ba6
·
verified ·
1 Parent(s): 0a32d05

Update app.py

Browse files

Fix summarization API call by using 'text' parameter

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -7,7 +7,8 @@ try:
7
  def generate_summary(text):
8
  for _ in range(3): # 重试3次
9
  try:
10
- response = client.summarization(inputs=text)
 
11
  return response[0]['summary_text'] if response and 'summary_text' in response[0] else "摘要生成失败,请重试。"
12
  except Exception as e:
13
  print(f"尝试失败: {e}")
 
7
  def generate_summary(text):
8
  for _ in range(3): # 重试3次
9
  try:
10
+ # 尝试直接传递文本作为位置参数
11
+ response = client.summarization(text)
12
  return response[0]['summary_text'] if response and 'summary_text' in response[0] else "摘要生成失败,请重试。"
13
  except Exception as e:
14
  print(f"尝试失败: {e}")