Jean-François Knebel commited on
Commit
d6a75c1
1 Parent(s): 7ea2391
Files changed (3) hide show
  1. Makefile +23 -0
  2. app.py +14 -0
  3. requirements.txt +4 -0
Makefile ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ install:
2
+ pip install --upgrade pip && \
3
+ pip install -r requirements.txt
4
+
5
+ test:
6
+ python -m pytest -vv --cov=hello --cov=greeting \
7
+ --cov=smath --cov=web tests
8
+ python -m pytest -nbval notebook.ipynb # test jupyter note book
9
+ # python -m pytest -v tests/test_web.py # if you just wat to test wev
10
+
11
+ debug:
12
+ python -m pytest -vv --pdb
13
+
14
+ one-test:
15
+ python -m pytest -vv tests/test_greeting.py::test_my_name4
16
+
17
+ format:
18
+ black *.py
19
+
20
+ lint :
21
+ pylint --disable=R,C hello.py
22
+
23
+ all: install lint test
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,4 @@
 
 
 
 
 
1
+ gradio
2
+ transformers
3
+ tensorflow
4
+ tf-keras