Spaces:
Runtime error
Runtime error
haiya
Browse files- Dockerfile +2 -0
- hugging_face/dataset.py +6 -1
- hugging_face/model.py +5 -1
Dockerfile
CHANGED
@@ -10,4 +10,6 @@ COPY . .
|
|
10 |
|
11 |
RUN mkdir ./.cache
|
12 |
|
|
|
|
|
13 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
10 |
|
11 |
RUN mkdir ./.cache
|
12 |
|
13 |
+
ENV HF_DATASETS_CACHE="./.cache"
|
14 |
+
|
15 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
hugging_face/dataset.py
CHANGED
@@ -7,7 +7,12 @@ def load_dataset(filename) -> DataFrame:
|
|
7 |
try:
|
8 |
df = read_csv(filename)
|
9 |
except:
|
10 |
-
datasets = hf_load_dataset(
|
|
|
|
|
|
|
|
|
|
|
11 |
df = DataFrame(data=datasets['train'])
|
12 |
df.to_csv(filename, index=False)
|
13 |
|
|
|
7 |
try:
|
8 |
df = read_csv(filename)
|
9 |
except:
|
10 |
+
datasets = hf_load_dataset(
|
11 |
+
REPO_ID,
|
12 |
+
data_files=filename,
|
13 |
+
encoding='latin-1'
|
14 |
+
)
|
15 |
+
|
16 |
df = DataFrame(data=datasets['train'])
|
17 |
df.to_csv(filename, index=False)
|
18 |
|
hugging_face/model.py
CHANGED
@@ -5,5 +5,9 @@ REPO_ID = "kompiangg/svm-hate-speech-classification"
|
|
5 |
|
6 |
def load_hugging_face_model(filename):
|
7 |
return joblib.load(
|
8 |
-
hf_hub_download(
|
|
|
|
|
|
|
|
|
9 |
)
|
|
|
5 |
|
6 |
def load_hugging_face_model(filename):
|
7 |
return joblib.load(
|
8 |
+
hf_hub_download(
|
9 |
+
REPO_ID,
|
10 |
+
filename,
|
11 |
+
local_dir="./models",
|
12 |
+
)
|
13 |
)
|