Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +12 -0
src/streamlit_app.py
CHANGED
|
@@ -1,4 +1,16 @@
|
|
| 1 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import fitz
|
| 3 |
import tempfile
|
| 4 |
import streamlit as st
|
|
|
|
| 1 |
import os
|
| 2 |
+
import tempfile
|
| 3 |
+
|
| 4 |
+
# Set cache directory to temp or app folder
|
| 5 |
+
cache_dir = os.path.join(tempfile.gettempdir(), "hf_cache")
|
| 6 |
+
os.makedirs(cache_dir, exist_ok=True)
|
| 7 |
+
|
| 8 |
+
os.environ["XDG_CACHE_HOME"] = cache_dir
|
| 9 |
+
os.environ["HF_HOME"] = cache_dir
|
| 10 |
+
|
| 11 |
+
# Now import OpenCLIPEmbeddingFunction
|
| 12 |
+
from chromadb.utils.embedding_functions import OpenCLIPEmbeddingFunction
|
| 13 |
+
|
| 14 |
import fitz
|
| 15 |
import tempfile
|
| 16 |
import streamlit as st
|