minnehwg commited on
Commit
b6198c3
·
verified ·
1 Parent(s): 6a9061f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -12
app.py CHANGED
@@ -1,13 +1,26 @@
 
 
1
  import gradio as gr
2
- def update(name):
3
- return f"Welcome to Gradio, {name}!"
4
-
5
- with gr.Blocks() as demo:
6
- gr.Markdown("Start typing below and then click **Run** to see the output.")
7
- with gr.Row():
8
- inp = gr.Textbox(placeholder="What is your name?")
9
- out = gr.Textbox()
10
- btn = gr.Button("Run")
11
- btn.click(fn=update, inputs=inp, outputs=out)
12
-
13
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
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()