Spaces:
Sleeping
Sleeping
Update sentiment_analysis_service.py
Browse files
src/expon/presentation/domain/services/sentiment_analysis_service.py
CHANGED
@@ -1,11 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
from typing import Dict
|
3 |
from huggingface_hub import login
|
4 |
import shutil
|
5 |
-
import os
|
6 |
-
|
7 |
-
os.environ['TRANSFORMERS_CACHE'] = '/tmp/huggingface'
|
8 |
-
os.makedirs('/tmp/huggingface', exist_ok=True)
|
9 |
|
10 |
class SentimentAnalysisService:
|
11 |
def __init__(self):
|
@@ -64,7 +65,6 @@ class SentimentAnalysisService:
|
|
64 |
"trust": "motivado"
|
65 |
}
|
66 |
|
67 |
-
|
68 |
mapped_emotion = emotion_mapping.get(raw_emotion, "desconocido")
|
69 |
|
70 |
return {
|
|
|
1 |
+
import os
|
2 |
+
# 👇 Redirigir el caché de Hugging Face y Transformers a /tmp
|
3 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/transformers"
|
4 |
+
os.environ["HF_HOME"] = "/tmp/huggingface"
|
5 |
+
|
6 |
from transformers import pipeline
|
7 |
from typing import Dict
|
8 |
from huggingface_hub import login
|
9 |
import shutil
|
|
|
|
|
|
|
|
|
10 |
|
11 |
class SentimentAnalysisService:
|
12 |
def __init__(self):
|
|
|
65 |
"trust": "motivado"
|
66 |
}
|
67 |
|
|
|
68 |
mapped_emotion = emotion_mapping.get(raw_emotion, "desconocido")
|
69 |
|
70 |
return {
|