Spaces:
Sleeping
Sleeping
Update app.py
Browse filesFix summarization API call by using 'text' parameter
app.py
CHANGED
|
@@ -7,7 +7,8 @@ try:
|
|
| 7 |
def generate_summary(text):
|
| 8 |
for _ in range(3): # 重试3次
|
| 9 |
try:
|
| 10 |
-
|
|
|
|
| 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}")
|