irtizak commited on
Commit
c00b106
1 Parent(s): d29dde1

Added files to repo

Browse files
Files changed (3) hide show
  1. Makefile +28 -0
  2. app.py +16 -0
  3. requirements.txt +5 -0
Makefile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ install:
2
+ pip install --upgrade pip &&\
3
+ pip install -r requirements.txt
4
+
5
+ test:
6
+ python -m pytest -vvv --cov=hello --cov=greeting \
7
+ --cov=smath --cov=web tests
8
+ python -m pytest --nbval notebook.ipynb #tests our jupyter notebook
9
+ #python -m pytest -v tests/test_web.py #if you just want to test web
10
+
11
+ debug:
12
+ python-m pytest -vv -pdb #Debugger is invoked
13
+
14
+ one-test:
15
+ python -m pytest -vv tests/test_greeting.py::test_my_name4
16
+
17
+ debugthree:
18
+ # not working the way i expect
19
+ python -m pytest -vv --pdb --maxfail=4 # drop to pdb for first three failures
20
+
21
+ format:
22
+ black *.py
23
+
24
+ lint:
25
+ pylint --disable=R,C *.py
26
+
27
+ all: install format
28
+ # removed lint test due to the import error
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ model = pipeline("summarization")
5
+
6
+
7
+ def predict(prompt):
8
+ summary = model(prompt)[0]["summary_text"]
9
+ return summary
10
+
11
+
12
+ with gr.Blocks() as demo:
13
+ textbox = gr.Textbox(placeholder="Enter text block to summarize", lines=4)
14
+ gr.Interface(fn=predict, inputs=textbox, outputs="text")
15
+
16
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio
2
+ transformers
3
+ tensorflow
4
+ pytest
5
+ pytest-cov