krrishD commited on
Commit
be09d8a
1 Parent(s): ef5ef3c

Upload with huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +27 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline("summarization", model="google/pegasus-multi_news")
5
+
6
+ def main(in_text):
7
+ print(in_text)
8
+ answer = pipe(in_text, min_length=5, max_length=20)
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
+ gr.Markdown("""#### powered by [Tassle](https://bit.ly/3LXMklV)""")
24
+
25
+
26
+ if __name__ == "__main__":
27
+ demo.launch(debug=True)
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio
2
+ transformers
3
+ torch
4
+ sentencepiece