Spaces:
Runtime error
Runtime error
Commit
·
93795ea
1
Parent(s):
26648cc
replace summarizer pipeline with a faster version
Browse files- Dockerfile +2 -1
- app/app.py +4 -1
Dockerfile
CHANGED
@@ -6,7 +6,8 @@ COPY ./requirements.txt /code/requirements.txt
|
|
6 |
|
7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
|
9 |
-
|
|
|
10 |
|
11 |
ENV TRANSFORMERS_CACHE=./code/models
|
12 |
|
|
|
6 |
|
7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
|
9 |
+
# run this to trigger model download to whatever machine this is running on
|
10 |
+
# RUN python3 -c 'from transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLM;model=AutoModelForSeq2SeqLM.from_pretrained("facebook/bart-large-cnn");model.save_pretrained("models");tokenizer=AutoTokenizer.from_pretrained("facebook/bart-large-cnn");tokenizer.save_pretrained("models")'
|
11 |
|
12 |
ENV TRANSFORMERS_CACHE=./code/models
|
13 |
|
app/app.py
CHANGED
@@ -8,7 +8,10 @@ from newspaper import Article
|
|
8 |
|
9 |
app = FastAPI()
|
10 |
|
11 |
-
|
|
|
|
|
|
|
12 |
|
13 |
@app.get("/")
|
14 |
def read_root():
|
|
|
8 |
|
9 |
app = FastAPI()
|
10 |
|
11 |
+
# see dockerfile. it has a line to download the model when the docket container is initialized
|
12 |
+
# summarizer = pipeline("summarization", "/code/models")
|
13 |
+
|
14 |
+
summarizer = pipeline("summarization", model="Falconsai/text_summarization")
|
15 |
|
16 |
@app.get("/")
|
17 |
def read_root():
|