Abdul Jaweed commited on
Commit
2b80fd3
·
1 Parent(s): 8695800

adding initial code

Browse files
Files changed (3) hide show
  1. Makefile +29 -0
  2. app.py +17 -0
  3. requirements.txt +3 -0
Makefile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ install:
2
+ pip install --upgrade pip &&\
3
+ pip install -r requirements.txt
4
+
5
+ text:
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
+
12
+ debug:
13
+ python -m pytest -vv --pdb #Debugger is invoked
14
+
15
+ one-test:
16
+ python -m pytest -vv tests/test_greeting.py::test_my_name4
17
+
18
+
19
+ debugthree:
20
+ #not working the way I expect
21
+ python -m pytest -vv -pdb --maxfail=4 # drop to PDB for first three failures
22
+
23
+ format:
24
+ black *.py
25
+
26
+ link:
27
+ pylint --disable=R,C *.py
28
+
29
+ all: install lint test format
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+
5
+ model = pipeline("Summarization")
6
+
7
+ def predict(promt):
8
+ summary = model(promt)[0]("summary_text")
9
+ return summary
10
+
11
+
12
+
13
+ with gr.Blocks() as demo:
14
+ textbox = gr.Textbox(placeholder="Enter the block to summarize", lines=4)
15
+ gr.Interface(fn=predict, inputs=textbox, outputs="text")
16
+
17
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ transformers
3
+ tensorflow