Ericahooooo commited on
Commit
d165430
·
verified ·
1 Parent(s): bb35586

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -1,3 +1,20 @@
1
  import gradio as gr, os
2
 
3
- (gr.load("models/fnlp/bart-base-chinese").launch(auth=("admin", os.environ["KEY"])))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()