add aapp
Browse files- app.py +12 -0
- makefile +23 -0
- requirements.txt +3 -0
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
model= pipeline("summarization")
|
| 5 |
+
|
| 6 |
+
def predict(promt):
|
| 7 |
+
summary=model(prompt)[0]["summary_text"]
|
| 8 |
+
return summary
|
| 9 |
+
with gr.Blocks() as demo:
|
| 10 |
+
textbox=gr.TextBox(placeholder="enter text to summarize",lines=4)
|
| 11 |
+
gr.Interface(fn=predict,inputs=textbox,outputs="text")
|
| 12 |
+
demo.launch()
|
makefile
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
install:
|
| 2 |
+
pip install --upgrade pip &&\
|
| 3 |
+
pip install -r requirements.txt
|
| 4 |
+
|
| 5 |
+
test:
|
| 6 |
+
python -m pytest -vv test_app.py
|
| 7 |
+
|
| 8 |
+
format:
|
| 9 |
+
black *.py
|
| 10 |
+
|
| 11 |
+
run:
|
| 12 |
+
python app.py
|
| 13 |
+
|
| 14 |
+
run-uvicorn:
|
| 15 |
+
uvicorn app:app --reload
|
| 16 |
+
|
| 17 |
+
killweb:
|
| 18 |
+
sudo killall uvicorn
|
| 19 |
+
|
| 20 |
+
lint:
|
| 21 |
+
pylint --disable=R,C app.py
|
| 22 |
+
|
| 23 |
+
all: install lint test
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
transformers
|
| 3 |
+
tensorflow
|