Spaces:
Running
Running
Jin Zhu
commited on
Commit
·
4fa8483
1
Parent(s):
2022987
Update app.py
Browse files- src/app.py +11 -6
src/app.py
CHANGED
|
@@ -1,6 +1,3 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
from FineTune.model import ComputeScore
|
| 3 |
-
import time
|
| 4 |
import os
|
| 5 |
from pathlib import Path
|
| 6 |
|
|
@@ -14,14 +11,22 @@ if os.environ.get('SPACE_ID'):
|
|
| 14 |
os.environ['STREAMLIT_SERVER_ENABLE_CORS'] = 'false'
|
| 15 |
|
| 16 |
# 设置 HuggingFace 缓存到可写目录
|
| 17 |
-
|
| 18 |
-
os.
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# 设置可写的配置目录
|
| 22 |
streamlit_dir = Path('/tmp/.streamlit')
|
| 23 |
streamlit_dir.mkdir(exist_ok=True, parents=True)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
# -----------------
|
| 26 |
# Page Configuration
|
| 27 |
# -----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
from pathlib import Path
|
| 3 |
|
|
|
|
| 11 |
os.environ['STREAMLIT_SERVER_ENABLE_CORS'] = 'false'
|
| 12 |
|
| 13 |
# 设置 HuggingFace 缓存到可写目录
|
| 14 |
+
CACHE_DIR = '/tmp/huggingface_cache'
|
| 15 |
+
os.makedirs(CACHE_DIR, exist_ok=True)
|
| 16 |
+
|
| 17 |
+
os.environ['HF_HOME'] = CACHE_DIR
|
| 18 |
+
os.environ['TRANSFORMERS_CACHE'] = CACHE_DIR
|
| 19 |
+
os.environ['HF_DATASETS_CACHE'] = CACHE_DIR
|
| 20 |
+
os.environ['HUGGINGFACE_HUB_CACHE'] = CACHE_DIR
|
| 21 |
|
| 22 |
# 设置可写的配置目录
|
| 23 |
streamlit_dir = Path('/tmp/.streamlit')
|
| 24 |
streamlit_dir.mkdir(exist_ok=True, parents=True)
|
| 25 |
|
| 26 |
+
import streamlit as st
|
| 27 |
+
from FineTune.model import ComputeScore
|
| 28 |
+
import time
|
| 29 |
+
|
| 30 |
# -----------------
|
| 31 |
# Page Configuration
|
| 32 |
# -----------------
|