Spaces:
Sleeping
Sleeping
permission
Browse files- Dockerfile +2 -0
- main_sentiment.py +2 -6
Dockerfile
CHANGED
|
@@ -15,5 +15,7 @@ RUN pip install -r requirements.txt
|
|
| 15 |
EXPOSE 7860
|
| 16 |
|
| 17 |
COPY --chown=user . .
|
|
|
|
|
|
|
| 18 |
|
| 19 |
CMD ["uvicorn", "src.main_sentiment:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 15 |
EXPOSE 7860
|
| 16 |
|
| 17 |
COPY --chown=user . .
|
| 18 |
+
RUN mkdir -p ./.cache
|
| 19 |
+
RUN chmod 777 ./.cache
|
| 20 |
|
| 21 |
CMD ["uvicorn", "src.main_sentiment:app", "--host", "0.0.0.0", "--port", "7860"]
|
main_sentiment.py
CHANGED
|
@@ -1,10 +1,5 @@
|
|
| 1 |
# Imports
|
| 2 |
-
import
|
| 3 |
-
# sys.path.insert(0, '../src/')
|
| 4 |
-
# sys.path.insert(0, '../src')
|
| 5 |
-
# sys.path.insert(0, 'src/')
|
| 6 |
-
# sys.path.insert(0, 'src')
|
| 7 |
-
|
| 8 |
from typing import Union
|
| 9 |
from src.utils import preprocess
|
| 10 |
from fastapi import FastAPI
|
|
@@ -19,6 +14,7 @@ app = FastAPI()
|
|
| 19 |
#/docs, page to see auto-generated API documentation
|
| 20 |
|
| 21 |
#loading ML/DL components
|
|
|
|
| 22 |
tokenizer = AutoTokenizer.from_pretrained('bert-base-cased')
|
| 23 |
model_path = f"Junr-syl/tweet_sentiments_analysis"
|
| 24 |
config = AutoConfig.from_pretrained(model_path)
|
|
|
|
| 1 |
# Imports
|
| 2 |
+
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from typing import Union
|
| 4 |
from src.utils import preprocess
|
| 5 |
from fastapi import FastAPI
|
|
|
|
| 14 |
#/docs, page to see auto-generated API documentation
|
| 15 |
|
| 16 |
#loading ML/DL components
|
| 17 |
+
os.environ['SENTENCE_TRANSFORMERS_HOME'] = './.cache'
|
| 18 |
tokenizer = AutoTokenizer.from_pretrained('bert-base-cased')
|
| 19 |
model_path = f"Junr-syl/tweet_sentiments_analysis"
|
| 20 |
config = AutoConfig.from_pretrained(model_path)
|