Spaces:
Runtime error
Runtime error
Update app.py
Browse filesEnsure direct access to response.summary_text
app.py
CHANGED
|
@@ -16,7 +16,8 @@ try:
|
|
| 16 |
try:
|
| 17 |
response = client.summarization(text)
|
| 18 |
print(f"API Response: {response}")
|
| 19 |
-
|
|
|
|
| 20 |
except Exception as e:
|
| 21 |
error_details = traceback.format_exc()
|
| 22 |
print(f"尝试失败,错误类型: {type(e).__name__}, 错误详情: {str(e)}, 堆栈: {error_details}")
|
|
|
|
| 16 |
try:
|
| 17 |
response = client.summarization(text)
|
| 18 |
print(f"API Response: {response}")
|
| 19 |
+
# 直接访问 response.summary_text
|
| 20 |
+
return response.summary_text if hasattr(response, 'summary_text') else "摘要生成失败,请重试。"
|
| 21 |
except Exception as e:
|
| 22 |
error_details = traceback.format_exc()
|
| 23 |
print(f"尝试失败,错误类型: {type(e).__name__}, 错误详情: {str(e)}, 堆栈: {error_details}")
|