bart-CN / app.py
Ericahooooo's picture
Update app.py
d165430 verified
raw
history blame
388 Bytes
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()