Spaces:
Build error
Build error
Update app.py
#3
by
AI-B
- opened
app.py
CHANGED
@@ -10,7 +10,8 @@ from langchain_chroma import Chroma
|
|
10 |
from chromadb import Documents, EmbeddingFunction, Embeddings
|
11 |
from chromadb.config import Settings
|
12 |
import chromadb #import HttpClient
|
13 |
-
import os
|
|
|
14 |
import re
|
15 |
import uuid
|
16 |
import gradio as gr
|
@@ -27,6 +28,13 @@ os.environ['CUDA_LAUNCH_BLOCKING'] = '1'
|
|
27 |
os.environ['CUDA_CACHE_DISABLE'] = '1'
|
28 |
|
29 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
### Utils
|
32 |
hf_token, yi_token = load_env_variables()
|
|
|
10 |
from chromadb import Documents, EmbeddingFunction, Embeddings
|
11 |
from chromadb.config import Settings
|
12 |
import chromadb #import HttpClient
|
13 |
+
import os
|
14 |
+
import tempfile
|
15 |
import re
|
16 |
import uuid
|
17 |
import gradio as gr
|
|
|
28 |
os.environ['CUDA_CACHE_DISABLE'] = '1'
|
29 |
|
30 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
31 |
+
|
32 |
+
# Ensure the temporary directory exists
|
33 |
+
temp_dir = '/tmp/gradio/'
|
34 |
+
os.makedirs(temp_dir, exist_ok=True)
|
35 |
+
|
36 |
+
# Set Gradio cache directory
|
37 |
+
gr.components.file.GRADIO_CACHE = temp_dir
|
38 |
|
39 |
### Utils
|
40 |
hf_token, yi_token = load_env_variables()
|