prsingh1982 commited on
Commit
7360bd5
·
1 Parent(s): 5d65cab

Summarizaation app

Browse files
Files changed (3) hide show
  1. Makefile +14 -0
  2. app.py +14 -0
  3. requirements.txt +7 -0
Makefile ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ install:
2
+ python -m pip install --upgrade pip &&\
3
+ python -m pip install -r requirements.txt
4
+
5
+ test:
6
+ python -m pytest -vv test_app.py
7
+
8
+ format:
9
+ black *.py
10
+
11
+ lint:
12
+ python -m pylint --disable=R,C app.py
13
+
14
+ all: install lint test format
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ model = pipeline("summarization")
5
+
6
+ def predict(prompt):
7
+ summary = model(prompt)[0]["summary_text"]
8
+ return summary
9
+
10
+ with gr.Blocks() as demo:
11
+ textbox = gr.Textbox(placeholder="Enter text block to summarize", lines=4)
12
+ gr.Interface(fn=predict, inputs=textbox, outputs="text")
13
+
14
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ gradio
2
+ transformers
3
+ tensorflow
4
+ pylint
5
+ pytest
6
+ black
7
+ ipython