Leo Liu commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,14 +26,8 @@ def text2story(text):
|
|
| 26 |
)
|
| 27 |
|
| 28 |
# 生成并后处理
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
# 提取核心内容(适配模型输出模式)
|
| 32 |
-
if "[STORY]:" in raw_output:
|
| 33 |
-
story = raw_output.split("[STORY]:")[-1].strip()
|
| 34 |
-
else:
|
| 35 |
-
story = raw_output
|
| 36 |
-
|
| 37 |
# 智能截断机制
|
| 38 |
target_length = min(max(len(story.split()), 50), 150)
|
| 39 |
return " ".join(story.split()[:target_length])
|
|
|
|
| 26 |
)
|
| 27 |
|
| 28 |
# 生成并后处理
|
| 29 |
+
story = pipe(text, return_full_text=False)[0]['generated_text']
|
| 30 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# 智能截断机制
|
| 32 |
target_length = min(max(len(story.split()), 50), 150)
|
| 33 |
return " ".join(story.split()[:target_length])
|