Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,20 @@
|
|
1 |
import gradio as gr, os
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr, os
|
2 |
|
3 |
+
model = gr.load("models/fnlp/bart-base-chinese")
|
4 |
+
|
5 |
+
def generate_summary(file):
|
6 |
+
with open(file.name, 'r', encoding='utf-8') as f:
|
7 |
+
text_content = f.read()
|
8 |
+
result = model.predict(text_content)
|
9 |
+
|
10 |
+
return result
|
11 |
+
|
12 |
+
demo = gr.Interface(
|
13 |
+
fn=generate_summary,
|
14 |
+
inputs=gr.File(),
|
15 |
+
outputs="text",
|
16 |
+
live=True
|
17 |
+
)
|
18 |
+
|
19 |
+
# 启动应用
|
20 |
+
demo.launch()
|