Spaces:
Sleeping
Sleeping
manue
commited on
Commit
·
8954f1d
1
Parent(s):
7163daa
Initialize environment variables for Hugging Face cache and remove use_cache from sentiment pipeline
Browse files- app.py +4 -0
- model/sentiment.py +1 -1
app.py
CHANGED
@@ -4,6 +4,10 @@ from flask_cors import CORS
|
|
4 |
from model.sentiment import Sentiment
|
5 |
from urllib.parse import unquote
|
6 |
|
|
|
|
|
|
|
|
|
7 |
app = Flask(__name__)
|
8 |
CORS(app)
|
9 |
|
|
|
4 |
from model.sentiment import Sentiment
|
5 |
from urllib.parse import unquote
|
6 |
|
7 |
+
import os
|
8 |
+
os.environ["HF_HOME"] = "/tmp/huggingface"
|
9 |
+
os.environ["TRANSFORMERS_CACHE"] = "/tmp/huggingface"
|
10 |
+
|
11 |
app = Flask(__name__)
|
12 |
CORS(app)
|
13 |
|
model/sentiment.py
CHANGED
@@ -3,6 +3,6 @@ from typing import Any
|
|
3 |
|
4 |
class Sentiment:
|
5 |
def __init__(self, line: str) -> (list | list[Any] | Any | None):
|
6 |
-
self.pipe = pipeline("text-classification", model="MilaNLProc/feel-it-italian-sentiment"
|
7 |
self.result = self.pipe(line)
|
8 |
|
|
|
3 |
|
4 |
class Sentiment:
|
5 |
def __init__(self, line: str) -> (list | list[Any] | Any | None):
|
6 |
+
self.pipe = pipeline("text-classification", model="MilaNLProc/feel-it-italian-sentiment")
|
7 |
self.result = self.pipe(line)
|
8 |
|