Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,26 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from util import pipeline
|
2 |
+
from util import load_model
|
3 |
import gradio as gr
|
4 |
+
|
5 |
+
cp_aug = 'minnehwg/finetune-newwiki-summarization-ver-augmented2'
|
6 |
+
|
7 |
+
def get_model():
|
8 |
+
checkpoint = cp_aug
|
9 |
+
tokenizer, model = load_model(checkpoint)
|
10 |
+
return tokenizer, model
|
11 |
+
|
12 |
+
tokenizer, model = get_model()
|
13 |
+
|
14 |
+
def generate_summary(input_text):
|
15 |
+
return pipeline(input_text)
|
16 |
+
|
17 |
+
demo = gr.Interface(
|
18 |
+
fn=generate_summary,
|
19 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your URL..."),
|
20 |
+
outputs=gr.outputs.Textbox(label="Generated Text"),
|
21 |
+
title="Chào mừng đến với hệ thống tóm tắt của Minne >.<",
|
22 |
+
description="Enter the URL to summarize and click 'Submit' to generate the summary."
|
23 |
+
)
|
24 |
+
|
25 |
+
if __name__ == "__main__":
|
26 |
+
demo.launch()
|