minnehwg commited on
Commit
d6a85e3
1 Parent(s): 0973139

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -20
app.py CHANGED
@@ -4,23 +4,35 @@ 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.Textbox(lines=2, placeholder="Enter your URL..."),
20
- outputs=gr.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()
 
 
 
 
 
 
 
 
 
 
 
 
 
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.Textbox(lines=2, placeholder="Enter your URL..."),
20
+ # outputs=gr.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
+ import gradio as gr
26
+ def update(name):
27
+ return f"Welcome to Gradio, {name}!"
28
+
29
+ with gr.Blocks() as demo:
30
+ gr.Markdown("Start typing below and then click **Run** to see the output.")
31
+ with gr.Row():
32
+ inp = gr.Textbox(placeholder="What is your name?")
33
+ out = gr.Textbox()
34
+ btn = gr.Button("Run")
35
+ btn.click(fn=update, inputs=inp, outputs=out)
36
+
37
+ demo.launch()
38
+