israelgonzalezb commited on
Commit
d1be271
1 Parent(s): b95aaa6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("summarization", model="google/bigbird-pegasus-large-arxiv")
5
+
6
+ def main(in_text):
7
+ print(in_text)
8
+ answer = pipe(in_text, min_length=5, max_length=200)
9
+ print(answer)
10
+ return answer[0]["summary_text"]
11
+
12
+ with gr.Blocks() as demo:
13
+ gr.Markdown("""# Summarization Engine!""")
14
+ with gr.Row():
15
+ with gr.Column():
16
+ text1 = gr.Textbox(
17
+ label="Input Text",
18
+ lines=1,
19
+ )
20
+ output = gr.Textbox(label="Output Text")
21
+ b1 = gr.Button("Summarize!")
22
+ b1.click(main, inputs=[text1], outputs=output)
23
+
24
+
25
+ if __name__ == "__main__":
26
+ demo.launch(debug=True)