Spaces:
Runtime error
Runtime error
File size: 388 Bytes
bb35586 03a9819 d165430 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr, 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()
result = model.predict(text_content)
return result
demo = gr.Interface(
fn=generate_summary,
inputs=gr.File(),
outputs="text",
live=True
)
# 启动应用
demo.launch()
|