sophicist commited on
Commit
e8e4ff3
·
verified ·
1 Parent(s): dfde77c

Synced repo using 'sync_with_huggingface' Github Action

Browse files
Files changed (3) hide show
  1. Makefile +22 -0
  2. app.py +18 -0
  3. requirements.txt +4 -0
Makefile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ install:
2
+ pip install -r requirements.txt
3
+
4
+ test:
5
+ python -m pytest -vvv --cov=hello --cov=greeting \
6
+ --cov=smath --cov=web tests
7
+ python -m pytest -nbval notebook.ipynb # test out jupyter notebook
8
+ # python -m pytest -v tests/tests_web.py
9
+
10
+ debug:
11
+ python -m pytest -vv --pdb # debugger is invoked
12
+
13
+ one-test:
14
+ python -m pytest -vv test/test_greeting.py::test_my_name4
15
+
16
+ format:
17
+ black *.py
18
+
19
+ lint:
20
+ pylint --disable=R,C *.py
21
+
22
+ all: install lint test format
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ # Initialize the summarization model using a PyTorch-based model
5
+ model = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
6
+
7
+ def predict(prompt):
8
+ summary = model(prompt)[0]['summary_text']
9
+ return summary
10
+
11
+ # Build the Gradio interface
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
+ # Launch the demo
17
+ demo.launch()
18
+
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio
2
+ transformers
3
+ tensorflow
4
+ tf-kerasgit