Spaces:
Runtime error
Runtime error
Update app.py
Browse filesFix summarization API call by removing unsupported max_length
4 unmodified lines567891011121314154 unmodified linestry:client = InferenceClient(model="sshleifer/distilbart-cnn-12-6")def generate_summary(text):prompt = text # 直接传入文本,无需额外提示for _ in range(3): # 重试3次try:response = client.summarization(prompt, max_length=60, min_length=10)return response[0]['summary_text']except Exception as e:print(f"尝试失败: {e}")time.sleep(1)4 unmodified lines5678910111213144 unmodified linestry:client = InferenceClient(model="sshleifer/distilbart-cnn-12-6")def generate_summary(text):for _ in range(3): # 重试3次try:response = client.summarization(inputs=text)return response[0]['summary_text'] if response and 'summary_text' in response[0] else "摘要生成失败,请重试。"except Exception as e:print(f"尝试失败: {e}")time.sleep(1)
app.py+2-3