Spaces:
Runtime error
Runtime error
File size: 652 Bytes
5fb04ff 03a9819 d165430 5fb04ff d165430 5fb04ff d165430 ff9e6f0 d165430 5fb04ff ff9e6f0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import gradio as gr
import os
model = gr.load("models/fnlp/bart-base-chinese")
def generate_summary(file):
# 读取上传的文本文件内容
with open(file.name, 'r', encoding='utf-8') as f:
text_content = f.read()
print("File Content:", text_content) # 添加此行进行调试
# 使用模型进行处理(在这里是摘要生成,你可以替换为你的具体模型处理逻辑)
result = model.predict(text_content)
return result
demo = gr.Interface(
fn=generate_summary,
inputs=gr.File(),
outputs="text",
live=False
)
# 启动应用并确保配置生效
demo.launch(share=True)
|