RamziRebai commited on
Commit
492e91a
·
1 Parent(s): 9cca1e1

add aplication file

Browse files
Files changed (3) hide show
  1. Makefile +17 -0
  2. app.py +14 -0
  3. requirements.txt +3 -0
Makefile ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ install:
2
+ pip install --upgrade pip &&\
3
+ pip install -r requirements.txt
4
+ test:
5
+ python -m pytest -vvv --cov=App_Cover --cov=greeting \
6
+ --cov=smath --cov=web tests
7
+ python -m pytest --nbval notebook.ipynb #test our jupyter notebook
8
+ python -m pytest -v tests/test_web.py #to test web
9
+ debug:
10
+ python -m pytest -vv --pdb
11
+ one-test:
12
+ python -m pytest -vv tests/test_greeting.py::test_my_name
13
+ format:
14
+ black *.py
15
+ lint:
16
+ pylint --disable=R,C *.py
17
+ 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 your text to summarize", lines=4)
12
+ gr.interface(fn=predict, inputs=textbox, outputs="text")
13
+
14
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio
2
+ transformers
3
+ tensorflow