Spaces:
Running
Running
Jin Zhu
commited on
Commit
·
e1a2fb3
1
Parent(s):
a002403
Update app.py
Browse files- src/app.py +3 -1
src/app.py
CHANGED
|
@@ -2,6 +2,8 @@ import streamlit as st
|
|
| 2 |
from FineTune.model import ComputeScore
|
| 3 |
import time
|
| 4 |
import os
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# -----------------
|
| 7 |
# Page Configuration
|
|
@@ -23,7 +25,7 @@ def load_model(from_pretrained, base_model, cache_dir, device):
|
|
| 23 |
"""
|
| 24 |
is_hf_space = os.environ.get('SPACE_ID') is not None
|
| 25 |
if is_hf_space:
|
| 26 |
-
cache_dir =
|
| 27 |
device = 'cpu'
|
| 28 |
print("Using **CPU** now!")
|
| 29 |
else:
|
|
|
|
| 2 |
from FineTune.model import ComputeScore
|
| 3 |
import time
|
| 4 |
import os
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
|
| 7 |
|
| 8 |
# -----------------
|
| 9 |
# Page Configuration
|
|
|
|
| 25 |
"""
|
| 26 |
is_hf_space = os.environ.get('SPACE_ID') is not None
|
| 27 |
if is_hf_space:
|
| 28 |
+
cache_dir = str(Path.home() / '.cache' / 'huggingface')
|
| 29 |
device = 'cpu'
|
| 30 |
print("Using **CPU** now!")
|
| 31 |
else:
|