conf changes

This commit is contained in:
Grégoire Mureau 2025-07-11 08:12:41 +02:00
parent 2d7ad3ae76
commit ac48e98aa9
6 changed files with 25 additions and 26 deletions

View file

@ -17,4 +17,6 @@ tests/
*aws* *aws*
.elasticbeanstalk .elasticbeanstalk
sentiment-api-465411-ccfc3af56be7.json sentiment-api-*.json
docker-compose.yml.example

View file

@ -9,4 +9,4 @@
*aws* *aws*
sentiment-api-465411-ccfc3af56be7.json sentiment-api-*.json

View file

@ -15,6 +15,14 @@ RUN apt-get update && \
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Install nltk resources at build time
RUN python3 -m nltk.downloader punkt \
&& python3 -m nltk.downloader punkt_tab \
&& python3 -m nltk.downloader stopwords \
&& python3 -m nltk.downloader wordnet \
&& python3 -m nltk.downloader omw-1.4
# Copy app code and configs # Copy app code and configs
COPY . . COPY . .

View file

@ -1,13 +0,0 @@
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "grgmdmn/sentiment_api:latest",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "8000"
}
],
"Logging": "/var/log/nginx"
}

View file

@ -20,6 +20,8 @@ services:
SMTP_FROM_ALIAS: "${SMTP_FROM_ALIAS}" # alias (optionnel) SMTP_FROM_ALIAS: "${SMTP_FROM_ALIAS}" # alias (optionnel)
ADMIN_EMAIL: "${ADMIN_EMAIL}" # email admin destinataire ADMIN_EMAIL: "${ADMIN_EMAIL}" # email admin destinataire
SENTIMENT_API_BASE_URL: "${SENTIMENT_API_BASE_URL}" # public api url (used to redirect Streamlit requests to FastAPI)
# only if you have a reverse proxy server # only if you have a reverse proxy server
# networks: # networks:
# - swag # - swag

View file

@ -5,17 +5,17 @@ from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer from nltk.stem import WordNetLemmatizer
# Assurer que les ressources nécessaires sont disponibles # # Assurer que les ressources nécessaires sont disponibles
try: # try:
stopwords.words('english') # stopwords.words('english')
word_tokenize("test") # word_tokenize("test")
WordNetLemmatizer().lemmatize("testing") # WordNetLemmatizer().lemmatize("testing")
except LookupError: # except LookupError:
nltk.download('punkt') # nltk.download('punkt')
nltk.download('punkt_tab') # nltk.download('punkt_tab')
nltk.download('stopwords') # nltk.download('stopwords')
nltk.download('wordnet') # nltk.download('wordnet')
nltk.download('omw-1.4') # nltk.download('omw-1.4')
def preprocess_tweet(tweet): def preprocess_tweet(tweet):
""" """