Spaces:
Sleeping
Sleeping
dewa
commited on
Commit
·
a449372
1
Parent(s):
709b1df
changes
Browse files- Makefile +12 -0
- app.py +12 -0
- requirement.txt +3 -0
Makefile
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
install:
|
| 2 |
+
pip install --upgrade pip &&\
|
| 3 |
+
pip install -r requirement.txt
|
| 4 |
+
test:
|
| 5 |
+
python -m pytest -vvv --cov=hello --cov=greeting \
|
| 6 |
+
--cov=s math --cov=web tests
|
| 7 |
+
python -m pytest --nbval notebook.ipynb #test jupyter notebooks
|
| 8 |
+
# python -m pytest -v tests/test_web.py # if just want to test the web
|
| 9 |
+
debug:
|
| 10 |
+
python -m pytest -vv --pdb #Debugger is invoked
|
| 11 |
+
one-test:
|
| 12 |
+
python -m pytest -vv tests/test_greeting.py::test_my_name4
|
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 11 |
+
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
| 12 |
+
iface.launch()
|
requirement.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
transformers
|
| 3 |
+
gradio
|