Sadeep Sachintha commited on
Commit ·
3f2f2b1
1
Parent(s): ad281c4
Switch to public Sinhala sentiment analysis model (sinbert-small)
Browse files- Dockerfile +1 -2
- app/model.py +1 -6
Dockerfile
CHANGED
|
@@ -23,8 +23,7 @@ COPY --chown=user . $HOME/app
|
|
| 23 |
|
| 24 |
# Pre-download the Hugging Face model during the build stage
|
| 25 |
# This saves time and bandwidth during container startup
|
| 26 |
-
RUN --
|
| 27 |
-
python -c "import os; from transformers import pipeline; token = open('/run/secrets/HF_TOKEN').read().strip(); pipeline('sentiment-analysis', model='keshan/sinhala-sentiment-analysis', token=token)"
|
| 28 |
|
| 29 |
# Make port 7860 available to the world outside this container
|
| 30 |
EXPOSE 7860
|
|
|
|
| 23 |
|
| 24 |
# Pre-download the Hugging Face model during the build stage
|
| 25 |
# This saves time and bandwidth during container startup
|
| 26 |
+
RUN python -c "from transformers import pipeline; pipeline('sentiment-analysis', model='sinhala-nlp/sinhala-sentiment-analysis-sinbert-small')"
|
|
|
|
| 27 |
|
| 28 |
# Make port 7860 available to the world outside this container
|
| 29 |
EXPOSE 7860
|
app/model.py
CHANGED
|
@@ -5,13 +5,8 @@ import os
|
|
| 5 |
|
| 6 |
logger = logging.getLogger(__name__)
|
| 7 |
|
| 8 |
-
# Login with token if available
|
| 9 |
-
hf_token = os.environ.get("HF_TOKEN")
|
| 10 |
-
if hf_token:
|
| 11 |
-
login(token=hf_token)
|
| 12 |
-
|
| 13 |
# Using a robust Sinhala sentiment analysis model from Hugging Face
|
| 14 |
-
MODEL_NAME = "
|
| 15 |
sentiment_pipeline = None
|
| 16 |
|
| 17 |
def load_model():
|
|
|
|
| 5 |
|
| 6 |
logger = logging.getLogger(__name__)
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
# Using a robust Sinhala sentiment analysis model from Hugging Face
|
| 9 |
+
MODEL_NAME = "sinhala-nlp/sinhala-sentiment-analysis-sinbert-small"
|
| 10 |
sentiment_pipeline = None
|
| 11 |
|
| 12 |
def load_model():
|