Amrrs commited on
Commit
1c3784d
1 Parent(s): f9d1001

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #python3
2
+ #build a text summarizer using hugging face and gradio
3
+ #https://pypi.org/project/gradio/
4
+ #https://huggingface.co/transformers/
5
+
6
+ import gradio as gr
7
+ import transformers
8
+ from transformers import pipeline
9
+
10
+ summarizer = pipeline("summarization")
11
+
12
+ def summarize(text):
13
+ return summarizer(text, max_length=200, min_length=30)[0]['summary_text']
14
+
15
+ gr.Interface(fn=summarize, inputs=gr.inputs.Textbox(lines=7, placeholder="Enter text here"), outputs="text").launch()